Cod sursa(job #854039)
Utilizator | Data | 12 ianuarie 2013 17:55:40 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.24 kb |
#include<fstream>
using namespace std;
int main()
{
ifstream f("euclid2.in");
ofstream g("euclid2.out");
int n,i,a,b;
f>>n;
for(i=0;i<n;i++)
{
f>>a>>b;
int c;
while(b)
{
c=a%b;
a=b;
b=c;
}
g<<a<<"\n";
}
return 0;
}