Cod sursa(job #260228)
Utilizator | Data | 16 februarie 2009 20:27:53 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.52 kb |
#include<stdio.h>
long x,y,l,r,n;
int main()
{
freopen("euclid2.in","r",stdin);
freopen("euclid2.out","w",stdout);
scanf("%ld",&n);
do
{
l++;
scanf("%ld%ld",&x,&y);
r=x%y;
while(r!=0)
{
x=y;
y=r;
r=x%y;
}
printf("%ld\n",y);
}
while(l<n);
return 0;
}