Get your own website
Python
C
Java
 
Python result:
C result:
Java result:
The Euclidean algorithm using subtraction:

120 - 25 = 95
95 - 25 = 70
70 - 25 = 45
45 - 25 = 20
25 - 20 = 5
20 - 5 = 15
15 - 5 = 10
10 - 5 = 5
The GCD of 120 and 25 is: 5
The Euclidean algorithm using subtraction:

120 - 25 = 95
95 - 25 = 70
70 - 25 = 45
45 - 25 = 20
25 - 20 = 5
20 - 5 = 15
15 - 5 = 10
10 - 5 = 5
The GCD of 120 and 25 is: 5
The Euclidean algorithm using subtraction:

120 - 25 = 95
95 - 25 = 70
70 - 25 = 45
45 - 25 = 20
25 - 20 = 5
20 - 5 = 15
15 - 5 = 10
10 - 5 = 5
The GCD of 120 and 25 is: 5