Cod sursa(job #577239)
Utilizator | Data | 9 aprilie 2011 21:59:58 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.4 kb |
#include <cstdio>
using namespace std;
int t, a, b;
void cmmdc()
{
while (b)
{
int r=a%b;
a=b;
b=r;
}
}
int main()
{
freopen ("euclid2.in","r",stdin);
freopen ("euclid2.out","w",stdout);
scanf ("%d ",&t);
while (t--)
{
scanf ("%d %d ",&a,&b);
cmmdc();
printf ("%d\n",a);
}
return 0;
}