package javaapplication1;
public class JavaApplication1 {
public static void main(String[] args) {
int a = 12, b = 20;
System.out.format("The GCD (greatest common divisor) of %d and %d is: %d\n", a, b, gcd(a, b));
}
static int gcd(int a, int b)
{
return b == 0 ? a : gcd(b, a % b);
}
}
/*
run:
The GCD (greatest common divisor) of 12 and 20 is: 4
*/