#!/usr/local/bin/gentee -r

func uint gcd( uint first second )
{
   if !second : return first
   return gcd( second, first % second )
}

func main<main>
{
   str     input
   uint    first second
   
   print("This program finds the greatest common divisor 
by the Euclidean Algorithm.\n\n")

   while 1
   {
      first = uint( congetstr( "Enter the first number ( enter 0 to exit ): ", input ))
      if !first : break
      
      second = uint( congetstr( "Enter the second number: ", input ))
      print("GCD = \( gcd( first, second ))\n\n")
   }
}
