Finding the GCD of two numbers
In this assignment, it’ll be finding the GCD(Greatest Common Divisor). This means I need to write a program to find the GCD of two numbers. Below, I have written the program and next to the hashtags are just a sentence that’ll explain to you what each part of the code is doing. #The two variables 'num' and 'ber' will be where the inputs will be stored in. When it starts it will show '(num)a: ' and you'll have to put a number in. This goes the same for '(ber)b: ' num = int(input("a: ")) ber = int(input("b: ")) #Then once the variable has gotten their information, they will go through this: def gcd(num, ber): if ber == 0: return num else: return gcd(ber, num % ber) #And last, it'll gather their answer and print it for you as a sentence. print(f"The GCD {num}, {ber} is {gcd(num, ber)}.") That’s all today. Bye!