# Spring 2002 CSCI 255 Project 2

This assignment is due Friday, 3 May.

The GCD, greatest common divisor, of two positive numbers
`N` and `M` is the largest number that
divides both `N` and `M`.
Over 2000 years ago, Euclid described an algorithm for computing
the GCD which is similar to the following recursive C function:

```
int GCD(int N, int M) {
if (N < M)
return GCD(M, N) ;
else if (N == M)
return N ;
else /* N > M */
return GCD(N-M, M) ;
}
```

Your assignment is to write this recursive function in
LC/2 using the run-time stack conventions described
in Section 14.5 of the textbook.
To relieve you of the burden of writing a "driver" function
for this routine, a copy of a main routine that
(1), inputs two numbers; (2), constructs a run-time stack;
(3), calls your function *which must be located at
instruction at x3000*; and (4) prints the result
of this call is stored in the file
`/usr/local/csci/255/proj2/proj2main.asm`.

## Turning in this assignment

This assignment is to be turned in by copying it to
your Computer Science Unix directory.
First create a protected directory `csci/255/proj2` as shown below:

`mkdir -p csci/255/proj2`
`cd csci/255/proj2`

Then save your completed assembly program in the file
`proj2.asm` within your
`csci/255/proj2` directory.