Saturday, October 13, 2012

Java Exercise #21: Greatest Common Divisor

This program is to print Greatest Common Divisor(GCD) for two integers.

Exercise: Write a program that takes two integers as input from user and prints the GCD as below.


Enter the first integer: 125
Enter the second integer: 2525
Greatest Common Divisor for 125 and 2525 is 25

Download Code: GCD

No comments:

Post a Comment