Cod sursa(job #293442)
Utilizator | Data | 1 aprilie 2009 20:43:14 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.31 kb |
#include<stdio.h>
long n,a,b;
long cmmdc(long,long);
int main(){
freopen("euclid2.in", "r",stdin);
freopen("euclid2.out", "w", stdout);
scanf("%d",&n);
for(long i=1;i<=n;i++){scanf("%d %d", &a,&b);
printf("%d", cmmdc(a,b));}
return 0;}
long cmmdc(long a,long b){if(b==0)return a;
return (b,a%b);}