Our FREE site is mostly funded by the Amazon ads ⇓below⇓.
Support us by clicking ⇑above⇑ next time you plan to buy a product on Amazon.
// This function convert decimal to binary number
using namespace std;
cout << "Enter a number:";
cin >> number;
int remainder, binary = 0, var = 1;
remainder = number % 2;
number = number / 2;
binary = binary + (remainder * var);
var = var * 10;
} while (number > 0);
cout << "the binary is :";
cout << binary;
cout << endl;