🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X
Questions




































Write a python program to find the GCD of two numbers.

Last Updated : 22 Nov 2026 Jan 24, Jul 24

Solution:

import math

# Input two numbers
num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))

# Calculate GCD
gcd_result = math.gcd(num1, num2)

print(f"The GCD of {num1} and {num2} is: {gcd_result}")
✔ Verified by Expert
Latest Updates