// File: gcd.cpp #include "gcd.h" //============================================== // gcd //============================================== // gcd(x,y) returns the greatest common divisor // (also called the largest common factor) of // x and y. // // Requirements: // 1. x and y must be nonnegative integers. // // 2. x and y must not both be 0. //============================================== int gcd(int x, int y) { if(x == 0) { return y; } else { return gcd(y % x, x); } }