done something with it ,
but i need improvement and like to see my prog working with above output i mean 12 bits on screen. how to do it ?
Like to see
C++ code plz
Code:
#include <iostream>
using namespace std;
int main() {
int n; // number to convert to binary
while (cin >> n) {
if (n > 0) {
cout << n << " (decimal) = ";
while (n > 0) {
cout << n%2;
n = n/2;
}
cout << " (binary) in reverse order" << endl;
} else {
cout << "Please enter a number greater than zero." << endl;
}
}
return 0;
}//end main