import java.io.*; class GCD1 { // Prompts for two numbers and gives their greatest common divisor // Recursive version public static void main(String[] args) throws IOException { int m,n; BufferedReader in = Text.open(System.in); System.out.print("Enter two numbers: "); m=Text.readInt(in); n=Text.readInt(in); System.out.print("Greatest common divisor: "); System.out.println(gcd(m,n)); } public static int gcd(int m,int n) { if(n==0) return m; else return gcd(n,m%n); } }