Cod sursa(job #143873)
Utilizator | Data | 26 februarie 2008 22:07:01 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.38 kb |
#include <stdio.h>
long long a, b;
void citire();
void cmmdc();
int main()
{
citire();
cmmdc();
return 0;
}
void cmmdc()
{
long long r;
while ( b != 0 )
{
r = a % b;
a = b;
b = r;
}
printf( "%lld", a );
}
void citire()
{
freopen( "euclid2.in", "rt", stdin );
freopen( "euclid2.out", "wt", stdout );
scanf( "%lld %lld", &a, &b );
}