Cod sursa(job #523546)
Utilizator | Data | 18 ianuarie 2011 15:47:43 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.27 kb |
#include<stdio.h>
long long t,i,a,b,r;
int main()
{
freopen("euclid.in","rt",stdin);
freopen("euclid.out","wt",stdout);
scanf("%lld",&t);
for(i=1;i<=t;i++)
{
scanf("%lld%lld",&a,&b);
while(b) { r=a%b;a=b;b=r; }
printf("%lld\n",a);
}
return 0;
}