ProAnswers.org

Write a C program to covert Decimal to Binary Conversion ?

#include

#include



#include



void main()



{



int no,r,sum=0,i=0;



clrscr();



printf(“

enter the number
”);

scanf(“%d”,&no);



while(no>0)



{



r=no%2;



sum=sum+pow(10,i)*r;



no=no/2;



i++;



}



printf(“

the binary value is %d”,sum);

getch();



}



[b]Output: [/b]



enter the number



8



the binary value is 1000