Cod sursa(job #574465)
Utilizator | Data | 7 aprilie 2011 10:54:37 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.32 kb |
#include <fstream>
using namespace std;
int a,b,t;
int cmmdc(int A,int B)
{
if(!B) return A;
return cmmdc(B,A%B);
}
int main()
{
ifstream f ("euclid2.in");
ofstream g ("euclid2.out");
f>>t;
for(;t;--t)
{
f>>a>>b;
g<<cmmdc(a,b)<<endl;
}
return 0;
}