0

hcf

programme to find hcf of any two numbers from the user

24th Aug 2016, 2:30 PM
Alan Roy
Alan Roy - avatar
1 Odpowiedź
+ 1
num1 = int(input("Enter first number: ")) num2 = int(input("Enter second number: ")) hcf = 1 if num1 > num2: smaller = num2 else: smaller = num1 for i in range(2,smaller + 1): if((num1 % i == 0) and (num2 % i == 0)): hcf = i print(hcf)
25th Aug 2016, 9:40 AM
Shrenik Gandhi
Shrenik Gandhi - avatar