#include <iostream>
using namespace std;
int main() {
int*a=new int;
int*b=new int;
cout << "Podaj a: ";
cin >> *a;
cout << "Podaj b: ";
cin >> *b;
cout << "NWD(" << *a << "," << *b << ") = ";
while (*a != *b) {
if (*a < *b)
*b -= *a;
else
*a -= *b;
}
cout << *a << endl;
delete a;
delete b;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQqYT1uZXcgaW50OwoJaW50KmI9bmV3IGludDsKCWNvdXQgPDwgIlBvZGFqIGE6ICI7CgljaW4gPj4gKmE7Cgljb3V0IDw8ICJQb2RhaiBiOiAiOwoJY2luID4+ICpiOwoJY291dCA8PCAiTldEKCIgPDwgKmEgPDwgIiwiIDw8ICpiIDw8ICIpID0gIjsKCXdoaWxlICgqYSAhPSAqYikgewoJCWlmICgqYSA8ICpiKQoJCQkqYiAtPSAqYTsKCQllbHNlCgkJCSphIC09ICpiOwoJfQoJY291dCA8PCAqYSA8PCBlbmRsOwoJZGVsZXRlIGE7CglkZWxldGUgYjsKCXJldHVybiAwOyAKfQ==