Greatest common divisor

You are encouraged to solve this task according to the task description, using any language you may know.
Task

Find the greatest common divisor   (GCD)   of two integers.


Greatest common divisor   is also known as   greatest common factor (gcf)   and   greatest common measure.



Related task

   least common multiple.


See also

   MathWorld entry:   greatest common divisor.
   Wikipedia entry:     greatest common divisor.


// Greatest common divisor
00 0E  GCD:   ENT  R0
01 1E         ENT  R1
02 21  Again: R2 = R1
03 10  Loop:  R1 = R0
04 02         R0 = R2
05 2D  Minus: DEC  R2
06 8A         JZ   Stop
07 1D         DEC  R1
08 C5         JNZ  Minus
09 83         JZ   Loop
0A 1D  Stop:  DEC  R1
0B C2         JNZ  Again
0C 80         JZ   GCD   // Display GCD in R0