CPSC250A Assignment 0 - Brute Force GCD

Due Friday September 9

The Geatest Common Divisor of two positive integers is the largest integer that divides the two integers with no remainder. The GCD is useful for reducing fractions to their lowest terms.


The file gcd.cc contains the outline for a program that reads in a pair of integers from the user, passes the entered integers to the the undefined method GCD, and prints the result. The GCD method should use a brute force algorithm to find the greatest common divisor of the two specified integers. The method can assume that the two parameters are positive integers, but should have a method comment that specifies this assumption. Be sure to test your code on multiple examples and on the cs server.


Tar your code in a file that contains your name and submit it on the course Inquire site.