Cod sursa(job #146909)
Utilizator | Data | 2 martie 2008 13:30:59 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.3 kb |
#include<stdio.h>
long cmmdc(long a, long b)
{
if (b)
return cmmdc(b, a%b);
return a;
}
int main()
{
freopen("euclid2.in", "r", stdin);
freopen("euclid2.out", "w", stdout);
long a, b;
scanf("%ld %ld", &a, &b);
printf("%ld\n", cmmdc(a,b));
fclose(stdout);
return 0;
}