//Decimal to binary number
#include <stdio.h>
long toBin(int);
int main() {
long bno;
int dno;
printf("Enter the Decimal number : ");
scanf("%d",&dno);
bno=toBin(dno);
printf("\nDecimal number of %d = %ld",dno,bno);
return 0;
}
long toBin(int dno){
long bno,remainder,f=1;
while(dno!=0){
remainder=dno%2;
bno=bno+remainder*f;
f=f*10;
dno=dno/2;
}
return bno;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: