Matuiss2

Solved-finding the GCD

Sep 14th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. # Algo in python of euclidean algo
  2. a = int(input("Type an exact number"))
  3. b = int(input("Type another exact number"))
  4.  
  5. while b != 0:
  6.     # we do a = bq+r then:
  7.     # we want to restart with a set to b and b set to r
  8.     c = b
  9.     b = a % b
  10.     a = c
  11. print(a)
Advertisement
Add Comment
Please, Sign In to add comment