Cod sursa(job #1101836)
Utilizator | Data | 9 februarie 2014 11:35:53 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.37 kb |
#include <cstdio>
long gcd(long x, long y) {
if ( y==0 )
return x;
return gcd(y, x%y);
}
int main() {
long x,y, T;
freopen("euclid2.in", "r", stdin);
freopen("euclid2.out", "w", stdout);
scanf("%ld", &T);
while ( T-- ) {
scanf("%ld %ld", &x, &y);
printf("%ld\n", gcd(x,y));
}
return 0;
}