Cod sursa(job #2264735)
Utilizator | Data | 20 octombrie 2018 11:26:54 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.26 kb |
#include <iostream>
using namespace std;
int main()
{
int x,y,c;
cin >> x >> y;
while(y)
{
c=x%y;
x=y;
y=c;
}
if(x==0&&y==0)
cout << "-1";
else
cout << x;
return 0;
}