Cod sursa(job #145206)
Utilizator | Data | 28 februarie 2008 16:25:56 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.32 kb |
#include <stdio.h>
#define INPUT "euclid2.in"
#define OUTPUT "euclid2.out"
int a,b;
int main()
{
freopen(INPUT,"r",stdin);
freopen(OUTPUT,"w",stdout);
scanf("%d%d",&a,&b);
while (a!=b)
if (a>b) a-=b;
else b-=a;
printf("%d\n",a);
fclose(stdin);
fclose(stdout);
return 0;
}