Friday, January 02, 2009

Progeam to convert Decimal number to Binary

Buzz It
/*Progeam to convert Decimal number to Binary*/

//

#include
#include
void main()
{
int b[50],i;
int n;
clrscr();
printf("Enter the number\n");
scanf("%d",&n);
for(i=0;n>0;i++)
{
b[i]=n%2;
n=n/2;
}
printf("The binary number is=\t");
for(i=i-1;i>=0;--i)
{
printf("%d",b[i]);
}
getch();
}


-->

0 comments:

Post a Comment