Euklides z odejmowaniem (rekurencyjnie)

#include <iostream>
using namespace std;


int nwd(int x, int y)
{
while(x!=y)
{
/*if(x<y)
return nwd(x,y-x);
else
return nwd(x-y,y);
*/
return x<y?nwd(x,y-x):nwd(x-y,y);
}
return x;
}

int main()
{
int a,b;
cout << “Podaj a= “;
cin >> a;
cout << “Podaj b=”;
cin >> b;
cout << “NWD liczb “<<a<<” i ” <<b<<“= “<< nwd(a,b);
}