CSC 343-Data Structures

Assignment #4 - p. 138. Exercise 3.2.2

Due Friday, September 30, 2016

The C expression m % n yields the remainders of m divided by n. Define the greatest common divisor (GCD) of two integers x and y by:
gcd(x, y) = yif (y <= x && x % y == 0)
gcd(x, y) = gcd(y, x)if (x < y)
gcd(x, y) = gcd(y, x % y)otherwise

You will submit a program listing (properly commented) and the output using the following data sets:

xy
328
2415
6448

[Back to the Assignments Page]