Cod sursa(job #553901)
Utilizator | Data | 14 martie 2011 13:34:17 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.33 kb |
#include<iostream.h>
#include<fstream.h>
int n,t,y;
int divi(int a,int b)
{
if(a%b==0) return b;
else return divi (b,a%b);
}
int main()
{
ifstream f;
f.open("euclid2.in");
ofstream g;
g.open("euclid2.out");
f>>n;
while(!f.eof()){
f>>t>>y;
g<<divi(t,y)<<endl;
}
f.close();
g.close();
return 1;
}