HW1_ch4
import java.util.Scanner;
public class HW {
public static int EuclideanHW1(int a, int b) {
while (b != 0) {
int num = b;
b = a % b;
a = num;
}
return a;
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter first Number (a): ");
int a = scanner.nextInt();
System.out.println("Enter second Number (b): ");
int b = scanner.nextInt();
int Result = EuclideanHW1(a, b);
System.out.println("gcd of ( " + a + " , " + b + " ) is: " + Result);
scanner.close();
}
}