Decimal to binary program in c is conversion program in c.

What is a decimal number?
Numbers we use in everyday life from 0 to 9 are the decimal numbers

What is a binary number?
A number expressed in base 2 represented in 0 and 1 are binary numbers.

How to convert decimal to binary
Decimal to binary conversion: we divide the decimal number by 2 continually which gives a reminder either 0 or 1 or until a final result is 0.
Decimal to binary formula:
Simply divide binary number by 2 and write down reminder o or 1 which is out binary number
Decimal to binary example Page Contents

## Decimal to binary algorithm

1. Declare variable
2. Divide decimal number by 2 continuously
3. If the result is 0 or 1 then store the result as a binary number
4. If the final result is zero then stop
5. Print binary number

## Decimal to binary program in c

```#include<stdio.h>
main()
{
int dec,temp,i,j=1,binary=0;
printf("Enter decimal number to convert to binary number\n");
scanf("%d",&dec);
temp=dec;
while(temp!=0)
{
i=temp%2;
binary=binary+(i*j);
temp=temp/2;
j=j*10;
}
printf("Binary number of %d is %d\n",dec,binary);
}```

Output : 