#include<iostream>
#include<cstdlib>
using namespace std;
int NWD(int a, int b)
{
if(b!=0)
return NWD(b,a%b);
return a;
}
int main()
{
int a, b;
cout<<"Podaj dwie liczby: ";
cin>>a>>b;
if(a == 0 && b == 0) {
cout << "DUPA" << endl;
return -1;
}
cout<<"NWD("<<a<<","<<b<<") = "<<NWD(a,b)<<endl;
system("pause");
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPGNzdGRsaWI+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwogCmludCBOV0QoaW50IGEsIGludCBiKQp7CiAgICBpZihiIT0wKQogICAgCXJldHVybiBOV0QoYixhJWIpOwoJCiAgICByZXR1cm4gYTsKfQogCmludCBtYWluKCkKewogICAgaW50IGEsIGI7CiAKICAgIGNvdXQ8PCJQb2RhaiBkd2llIGxpY3pieTogIjsKICAgIGNpbj4+YT4+YjsKICAgIAogICAgaWYoYSA9PSAwICYmIGIgPT0gMCkgewogICAgCWNvdXQgPDwgIkRVUEEiIDw8IGVuZGw7CiAgICAJcmV0dXJuIC0xOwogICAgfQogCiAgICBjb3V0PDwiTldEKCI8PGE8PCIsIjw8Yjw8IikgPSAiPDxOV0QoYSxiKTw8ZW5kbDsKIAogICAgc3lzdGVtKCJwYXVzZSIpOwogICAgcmV0dXJuIDA7Cn0=