Program to convert digit to binary

Program to convert digit to binary 

#include<stdio.h>
void main()
{
 int num;
 long a=1,bin=0,rem;
 printf("Entet a number : ");
 scanf("%d",&num);
 while(num>0)
{
 rem=num%2;
 bin=bin+rem*a;
 num/=2;
 a*=10;
 }
 printf(" binary no.=%ld \n",bin);

}

out put:-

No comments:

hia friends you are seeing my blogger thank's. Powered by Blogger.