#12784: JAVA AC解參考


allen11513@gmail.com (董驊)


public class GCD {
    public static int gcd(int a,int b) {
        while(b !=0) {
              int c = a%b;
              a=b; b=c;}
     return a ;}
    public static void main(String[] args) {
        java.util.Scanner cd = new java.util.Scanner(System.in);
        while(cd.hasNext()){
              int g = cd.nextInt();
              int c = cd.nextInt();
              int gcd = gcd(g,c);
             System.out.println(gcd);}
}}