I am trying to convert a decimal to binary such as 192 to 11000000. I just need some simple code to do this but the code I have so far doesn\'t work:
void de
This is the simplest way to do it
#include void main() { int n,i,j,sum=0; printf("Enter a Decimal number to convert it to binary : "); scanf("%d",&n); for(i=n,j=1;i>=1;j*=10,i/=2) sum+=(i%2)*j; printf("\n%d",sum); }