Cod sursa(job #549800)
Utilizator | Data | 8 martie 2011 22:35:06 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.26 kb |
#include<fstream>
using namespace std;
ifstream fin("euclid2.in");
ofstream fout("euclid2.out");
int main()
{int a,b,r,x;
fin>>x;
while(x>0)
{fin>>a>>b;
while(a%b!=0)
{r=a%b;
a=b; b=r;
}
fout<<b<<"\n";
x--;
}
fin.close();
fout.close();
return 0;
}