//program to find binary equivalent of a decimal no.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int arr[10];
int ctr=0;
long int n,quo=0,rem=0;
cout<<"Enter A No. "<<endl;
cin>>n;
for(quo=n;quo!=0;ctr++)
{
rem=quo%2;
arr[ctr]=rem;
quo=quo/2;
}
cout<<"Binary Equivalent Of "<<n<<" is-----> ";
for(ctr=ctr-1;ctr>=0;ctr--)
{
cout<<arr[ctr];
}
getch();
}//end main
No comments:
Post a Comment