Cod sursa(job #1288780)
Utilizator | Data | 9 decembrie 2014 05:26:52 | |
---|---|---|---|
Problema | Divk | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
//http://www.infoarena.ro/problema/cmmdc
#include<iostream>
#include<fstream>
using namespace std;
int euclid(unsigned a, unsigned b)
{
int c;
while (b) {
c = a % b;
a = b;
b = c;
}
return a;
}
int main()
{
unsigned a,b;
ifstream f("cmmdc.in");
ofstream g("cmmdc.out");
f>>a;f>>b;
if(euclid(a,b)==1)
g<<"0";
else
g<<euclid(a,b);
}