Cod sursa(job #145243)

Utilizator thekrisserzaharia cristian thekrisser Data 28 februarie 2008 17:15:36
Problema Algoritmul lui Euclid Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.39 kb
    #include <stdio.h>  
      
    int A, B;  
      
    int gcd(int a, int b)  
    {  
        if (!b) return a;  
        return gcd(b, a % b);  
    }  
     
   int main(void)  
   {  
       freopen("euclid2.in", "r", stdin);  
       freopen("euclid2.out", "w", stdout);  
    
      scanf("%d %d", &A, &B);  
      printf("%d\n", gcd(A, B));  
     
       return 0;  
 }