fork download
  1. class gcd:
  2.  
  3. def calculategcd(num1,num2):
  4. if num2==0:
  5. return num1
  6. else:
  7. return gcd.calculategcd(num2,num1%num2)
  8.  
  9.  
  10. def main():
  11. number1=24
  12. number2=42
  13. result=gcd.calculategcd(number1,number2)
  14. print(f"The GCD of {number2} and {number1} equals to {result}")
  15.  
  16. if __name__=="__main__":
  17. main()
Success #stdin #stdout 0.09s 14056KB
stdin
Standard input is empty
stdout
The GCD of 42 and 24 equals to 6