Cod sursa(job #273927)
Utilizator | Data | 9 martie 2009 11:04:55 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.39 kb |
#include <stdio.h>
using namespace std;
int main()
{
freopen("euclid2.in","r",stdin);
freopen("euclid2.out","w",stdout);
long x;
scanf("%ld", &x);
long a,b,r;
while(x!=0)
{
scanf("%ld",&a);
scanf("%ld",&b);
while(b!=0){r=a%b;a=b;b=r;}
printf("%ld\n", a);
x--;
}
return 0;
}