C PROGRAM CONVERSION OF DECIMAL TO BINARY
void main()
{
int n,m,no=0,a=1,rem;
clrscr();
printf("Enter any decimal number->");
scanf("%d",&n);
m=n;
while(n!=0)
{
rem=n%2;
no=no+rem*a;
n=n/2;
a=a*10;
}
printf("The value %d in binary is->",m);
printf("%d",no);
getch();
}
No comments:
Post a Comment