C Program for the Conversion of Binary to Decimal Number

Decimal Numbers:
Decimal numbers has a radix 10. Decimal numbers use a combination of 0,1,2,3,4,5,6,7,8,9.
Binary Numbers:
Binary numbers has a radix of 2. Binary numbers use a combination of 0’s and 1’s.
Conversion from binary number system to decimal number system can be done by multiplying the digits with 2 raised to the power of its position from left to right as the below

This code will work for binary numbers with 10 digits and only for integers, due to the data type restriction of C language.

Source Code:
            Binary to decimal conversion using C 
            Author: sourcecodesonline.blogspot.com
int main(void)  
{    unsigned long dec_no=0,bin_no,pow=1;  
  printf("\n\t\t\tBinary to decimal conversion");  
  printf("\n\tEnter the binary number\t:");  
  printf("The decimal equivalent is %ld",dec_no);  
Next Post »

Still not found what you are looking for? Try again here.