Cod sursa(job #307832)
Utilizator | Data | 25 aprilie 2009 10:14:53 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.35 kb |
#include <stdio.h>
int t,a,b,r;
void readd(),solve();
int main()
{
readd();
solve();
return 0;
}
void readd()
{
freopen("euclid2.in","r",stdin);
freopen("euclid2.out","w",stdout);
scanf("%d",&t);
}
void solve()
{
for(;t;t--)
{
scanf("%d%d",&a,&b);
while(b)
{
r=a%b;
a=b;
b=r;
}
printf("%d\n",a);
}
}