Computing the Greatest Common Divisor (GCD)

This applets takes two integer (and non-zero) numbers a and b and computes their GCD by using the Euclidean algorithm:
r = a % b
while (r != 0)  
{       
  a = b;
  b = r;
  r = a % b;
}
output(b)