//WSQ12
#include <iostream>
using namespace std;
int gcd (int x, int y){
int yy;
int xx;
int z=1;
while(z!=0){
xx=x;
yy=y;
x=y;
y=xx%yy;
z=(x%y);
}
return y;}
int main(){
int x,y;
cout<<“Dame el mayor valor “<<endl;
cin>>x;
cout<<“Dame el menor valor “<<endl;
cin>>y;
if(y>x){
cout<<“El primer valor debe ser mayor o igual al segundo “<<endl;
}
else{
cout<<“El máximo común divisor es “<<gcd(x,y)<<endl;
}
return 0;}
Here’s the code:
]]>Foto: https://flic.kr/p/sUJ9TM
Estaba fácil y no tuve ningún problema en hacerlo. Aquí esta el link de mi código:
]]>This one was really easy.
]]>It was just taking both numbers and getting its module, then dividing the second number and the module, until the module was 0.
]]>