using namespace std; #include int Greatest_Common_Divisor (int j, int k); int Greatest_Common_Divisor (int j, int k) // Returns greatest common divisor of j and k { if (j == 0) return k; else return Greatest_Common_Divisor (k % j, j); } int main () { int small, large; // Get two integers from user; put them in proper order cout << "Please input an integer: "; cin >> small; cout << "Please input another integer: "; cin >> large; if (small > large) { // Swap small and large int temp = small; small = large; large = temp; } // Compute GCD of small and large if ((small < 0) || (large <= 0)) // Can't find GCD cout << "\nSorry, both integers must be non-negative, " << "and one must be positive"; else // Compute and report GCD cout << "\nGCD = " << Greatest_Common_Divisor (small, large) << "\n"; }