Cod sursa(job #1776081)
Utilizator | Data | 10 octombrie 2016 22:17:54 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.39 kb |
#include <fstream>
using namespace std;
ifstream fin ("cmmdc.in");
ofstream fout ("cmmdc.out");
unsigned long int a, b, r, A, B;
int main()
{
fin >> a >> b;
if (a==0 || b==0)
fout << 0;
else{
while (b!=0)
{
r=a%b;
a=b;
b=r;
}
if (a==1)
fout << 0;
else
fout << a;
}
return 0;
}