Python Online Compiler
Example: GCD of Two Numbers in Python using Function
C
C++
C#
Java
Python
PHP
main.py
STDIN
Run
# GCD of Two Numbers in Python using Function # It will find the GCD def gcd(x, y): while x != y: if x > y: x = x - y else: y = y - x return x # It's the driver code p, q = None, None # To store the two positive numbers print ("TWO POSITIVE INTEGER NUMBERS::") p = int (input ()) q = int (input ()) # It will print the final output print ("\nGCD =", gcd (p, q))
190 60
Output
Clear
ADVERTISEMENTS