#include #include using namespace std; void printBinary(int); int main() { int n1,n2, remainder;string str1, str2; there: cout << "Please enter positive integers : "; cin >> n1; // create a try block or simply use if logic if (n1 < 0) { cout << " Value should be more than 0.\n"; } else { n2 = n1; for(n1; n1 >=1; ) { remainder = n1 % 2; cout <>str2; if(str2=="y"){ goto there;} // differed in different windows, workd in Windows 7(64) bit , //not in Xp 32 bit service 3 pk //if((str2=="n")||(str2!="")){exit(1);} if((str2=="n")||(str2!="")){return 0;} return 0; } void printBinary(int n2) { int remainder; if(n2 <= 1) { cout << n2; return; } //binaries / divisable by 2 remainder = n2 % 2; //using bitshift operator printBinary(n2 >> 1); cout << remainder; }