Cod sursa(job #2479624)
Utilizator | Data | 24 octombrie 2019 08:44:13 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | c-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.42 kb |
#include <stdio.h>
#include <stdlib.h>
long int t,a,b;
int main()
{
freopen("euclid2.in", "r", stdin);
freopen("euclid2.out", "w", stdout);
scanf("%ld", &t);
while(t){
scanf("%ld", &a);
scanf("%ld", &b);
long int r;
while(b){
r=a%b;
a=b;
b=r;
}
printf("%ld\n", a);
--t;
}
return 0;
}