Cod sursa(job #1201140)
Utilizator | Data | 24 iunie 2014 15:38:29 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 60 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.34 kb |
#include <fstream>
using namespace std;
ifstream f("euclid2.in");
ofstream g("euclid2.out");
int main()
{
int a,b,t;
f>>t;
while(f>>a>>b)
{
while(a!=b)
if(a>b)
a-=b;
else
b-=a;
g<<a<<"\n";
}
f.close();
g.close();
return 0;
}