//********************************************************************
// Example2GCD_Euclidean.java
//
// We find the greatest common divisor of two integers using the
// Euclidean algorithm.
//********************************************************************

class Example2GCD_Euclidean
{
   public static void main (String[] args)
   {
      int m = 1 + (int) (100 * Math.random());
      int n = 1 + (int) (100 * Math.random());
      System.out.println("The first number is " + m +
                         "\nThe second number is " + n);
      // Replaces the larger integer by its remainder modulo the
      // smaller until the smaller becomes 0
      while ((m > 0) && (n>0))
         if (m > n)
            m %= n;
         else
            n %= m;
      System.out.println("gcd = " + (m + n));
   }// main
}// class Example2GCD_Euclidean
