Cod sursa(job #1491444)
Utilizator | Data | 25 septembrie 2015 15:09:56 | |
---|---|---|---|
Problema | Algoritmul lui Euclid | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.36 kb |
#include <iostream>
#include <fstream>
using namespace std;
int algorithm(int x , int y){
int z;
z=x%y;
x=y;
y=z;
if(y>0) algorithm(x , y);
else return x;
}
int main()
{
ifstream f("euclid2.in");
ofstream g("euclid2.out");
int x,y;
f>>x>>y;
if(x<y) switch(x , y);
g<<algorithm(x , y);
return 0;
}