Wednesday, November 18, 2015
C++ Program to Convert Decimal to Binary in Reversed Form
Also Read: C++ Program to Check If a Character is Small, Capital, Number or Special Character
C++ Program to Convert Decimal to Binary in Reversed Form
#include <iostream.h>
#include <stdio.h>
int main()
{
int n;
cout<<"enter a decimal number to convert to binary: ";
while (cin >> n)
{
if (n > 0)
{
cout <<"binary equivalent of "<<n<<" in reverse order is: ";
while (n > 0)
{
cout << n%2;
n = n/2;
}
}
else
{
cout << "Please enter a number greater than zero." << endl;
}
}
return 0;
}
Also Read: C++ Program For Binary Equivalent Of A Decimal Number