GCD

From 1992 Niagara South Programming Competition, with no modifications:

The Euclidean algorithm for finding the GCD (greatest common divisor) of two positive integers is to repeatedly replace the larger of the two numbers with the difference of the two numbers until the numbers become equal, at which point they are both equal to the desired GCD.  Write a program which accepts two positive integers as input and gives the GCD as output.

Save as "NS1992A2-GCD".
Comments