Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int gcd(int a,int b){
- int rem;
- while(rem!=0){
- rem=b%a;
- b=a;
- a=rem;
- }
- return b;
- }
- int main()
- {
- int i, n, f1, f2, m;
- scanf("%d", &n);
- for(i=1;i<=n;i++){
- scanf("%d%d", &f1,&f2);
- m=gcd(f1,f2);
- printf("%d\n", m);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment