C++ Program to Convert Decimal to Binary
Master C++ with Real-time Projects and Kickstart Your Career Start Now!!
Program 1
// Decimal to Binary
#include<iostream>
#define clrscr() system("cls")
using namespace std;
int main()
{
int d,bin[100],i=0,r;
clrscr();
cout<<"\nEnter decimal number";
cin>>d;
while(d!=0)
{
r=d%2;
bin[i]=r;
d=d/2;
i++;
}
i--;
while(i>=0)
{
cout<<bin[i];
i--;
}
return 0;
}
Your 15 seconds will encourage us to work even harder
Please share your happy experience on Google

