Cod sursa(job #471662)
Utilizator | Data | 20 iulie 2010 12:46:34 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.44 kb |
#include <iostream>
#include <stdio.h>
#define fin "text.in"
#define fout "text.out"
using namespace std;
int main()
{
freopen(fin,"r",stdin);
freopen(fout,"w",stdout);
int a,b,r,n;
scanf("%d",&n);
while(n)
{
scanf("%d %d",&a,&b);
while(b)
{
r=a%b;
a=b;
b=r;
}
printf("%d\n",a);
n--;
}
return 0;
}