1 #include<iostream> 2 using namespace std; 3 4 int Gcd(int a,int b){ 5 if(a%b==0) return b; 6 else return Gcd(b,a%b); 7 } 8 9 int main(){ 10 int a,b; 11 while(cin>>a>>b) 12 cout<<Gcd(a,b)<<endl; 13 return 0; 14 }
1 #include<iostream> 2 using namespace std; 3 4 int Gcd(int a,int b){ 5 if(a%b==0) return b; 6 else return Gcd(b,a%b); 7 } 8 9 int main(){ 10 int a,b; 11 while(cin>>a>>b) 12 cout<<Gcd(a,b)<<endl; 13 return 0; 14 }