Cod sursa(job #150956)
Utilizator | Data | 7 martie 2008 17:49:36 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.31 kb |
#include<fstream.h>
long long a,b;
long long cmmdc(long long a,long long b)
{
if(a>b)
return cmmdc(a-b,b);
else
if(b>a)
return cmmdc(a,b-a);
else
return a;
}
int main()
{
ifstream f("euclid2.in");
ofstream g("euclid2.out");
f>>a>>b;
g<<cmmdc(a,b);
return 0;
}