Cod sursa(job #385290)
Utilizator | Data | 22 ianuarie 2010 15:38:12 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.23 kb |
#include <fstream.h>
void main()
{
int n,a,b,r;
ifstream f("euclid2.in");
ofstream o("euclid2.out");
f>>n;
while(n--)
{
f>>a>>b;
while (b)
{
r=a%b;
a=b;
b=r;
}
o<<b<<endl;
}
}