10 Mar 2013

Decimal to Binary Conversion

/*

Program to convert decimal to binary....

*/

#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,c,d;
clrscr();
cout<<"Enter your decimal number:";
cin>>a;
while (a>0)
{
 b=a%2;
 a=a/2;
 cout<<b;
}
cout<<endl<<"Enter the digits you see:"<<endl;
cin>>d;
while(d)
{
 c=d%10;
 cout<<c;
 d=d/10;
}
getch();
}

Categories: , ,

0 comments:

Post a Comment

Copyright © UPgradeCODING | Powered by Blogger