import java.util.Scanner;
public class GCD{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int a,b;
while( sc.hasNext() ){
a = sc.nextInt();
b = sc.nextInt();
int i = 0;
while( b != 0 ){
i = a % b;
a = b;
b = i;
}
System.out.println( a );
}
}
}
題目
沒有留言:
張貼留言