trojanxem

Untitled

Jul 26th, 2012
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int nwd(int a, int b){
  4.         if(b == 0) return a;
  5.         return nwd(b, a % b);
  6. }
  7.  
  8.  
  9. int main(){
  10.  
  11.         unsigned t;
  12.         int a, b;
  13.  
  14.         scanf("%d", &t);
  15. int i =0;
  16.         for(i = 0; i < t; ++i){
  17.                 scanf("%d %d", &a, &b);    
  18.                 printf(nwd(a,b));            
  19.                
  20.         }
  21.          
  22.         return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment