#include <iostream>
using namespace std;
int main() {
int c, n;
cout<<"Podaj c: "<<endl;
cin>>c;
cout<<"Podaj n: "<<endl;
cin>>n;
for(int i=1;i<=n;++i) {
if(c%2) {
c=3*c+1;
} else {
c=c/2;
}
cout<<"i="<<i<<", c="<<c<<endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgYywgbjsKCWNvdXQ8PCJQb2RhaiBjOiAiPDxlbmRsOwoJY2luPj5jOwoJY291dDw8IlBvZGFqIG46ICI8PGVuZGw7CgljaW4+Pm47Cglmb3IoaW50IGk9MTtpPD1uOysraSkgewoJCWlmKGMlMikgewoJCQljPTMqYysxOwoJCX0gZWxzZSB7CgkJCWM9Yy8yOwoJCX0KCQljb3V0PDwiaT0iPDxpPDwiLCBjPSI8PGM8PGVuZGw7Cgl9CglyZXR1cm4gMDsKfQ==