Cod sursa(job #419599)
| Utilizator | Data | 17 martie 2010 18:42:12 | |
|---|---|---|---|
| Problema | Algoritmul lui Euclid | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.44 kb |
// algoritmul lui euclid.cpp : Defines the entry point for the console application.
//
using namespace std;
#include<fstream>
ifstream f("euclid2.in.txt");
ofstream g("euclid2.out.txt");
int cmmdc(int a, int b)
{ if (b==0)
return a;
else
return cmmdc(b,a%b);
}
int _tmain(int argc, _TCHAR* argv[])
{ int n,i,a,b;
f>>n;
for(i=0;i<n;i++)
{
f>>a;f>>b;
g<<cmmdc(a,b);
g<<endl;
}
f.close();
g.close();
return 0;
}
