import java.util.Scanner;
public class GcdTest {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    char firstChar  = 'y';
    String answer = "";
    // loop while you keep getting answers starting with y
    do {
      // test Gcd class
      System.out.print("Enter first number: ");
      int a = in.nextInt();
      System.out.print("Enter second number: ");
      int b = in.nextInt();
      while ( ! ( a > 0 && b > 0 ) ) {
        // it is not true that both numbers are pos
        // error message
        System.out.println("Invalid numbers");
        // read in two more numbers
        System.out.print("Enter first number: ");
        a = in.nextInt();
        System.out.print("Enter second number: ");
        b = in.nextInt();
      }
      // both numbers should be positive here
      Gcd gcd1 = new Gcd(a, b);
      System.out.println(gcd1);
      
      // ask user if wants to repeat
      System.out.print("Would you like to continue? (y or n) ");
      answer = in.next();
      firstChar = answer.charAt(0);
    } while (firstChar == 'y' || firstChar == 'Y');
  }
}