Cod sursa(job #2044414)
Utilizator | Data | 21 octombrie 2017 09:53:34 | |
---|---|---|---|
Problema | Algoritmul lui Euclid extins | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.37 kb |
#include <cstdio>
using namespace std;
int x,y,n;
int cmmdc(int x,int y)
{
if(y ==0)
return x;
return cmmdc(y,x%y);
}
int main()
{
freopen("cmmdc.in","r",stdin);
freopen("cmmdc.out","w",stdout);
scanf("%d %d",&x,&y);
if(cmmdc(x,y) == 1)
printf("0");
else
printf("%d\n",cmmdc(x,y));
return 0;
}