Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int gcd(int a,int b){
- while((a%=b)&&(b%=a));
- return a+b;
- }
- int main(){
- int a , b , t;
- scanf("%d",&t);
- while( t-- ){
- scanf("%d %d", &a , &b);
- printf("%d\n", gcd( a , b ));
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement