Cod sursa(job #194642)
Utilizator | Data | 12 iunie 2008 14:18:40 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | c | Status | done |
Runda | Arhiva educationala | Marime | 0.39 kb |
#include <stdio.h>
int main (void)
{
unsigned int test, nrTeste, a, b, bak;
freopen("euclid2.in", "r", stdin);
freopen("euclid2.out", "w+", stdout);
scanf("%u\n", &nrTeste);
for (test=0; test<nrTeste; ++test) {
scanf("%u %u\n", &a, &b);
while (b) {
bak = b;
b = a%b;
a = bak;
}
printf("%u\n", a);
}
fclose(stdin);
fclose(stdout);
return 0;
}