Binary to decimal program in c is Conversion program to convert binary to decimal 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 binary to decimal
Binary to decimal conversion: write down the powers of two start from right to left. Calculate the power of 2 for each digit. Write down the final value of each power of two. Add the final values. This final result is our decimal number.
Binary to the decimal formula :
Decimal number = Add the power of 2 for each digit in a binary number.
Binary to decimal example

Page Contents

## Binary to decimal algorithm

1. Declare variable
2. Find the power of two for each digit start from right to left
3. Calculate the power of two
5. Print decimal number

## Binary to decimal program in c

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

Output :