C program to convert binary to decimal number



This page has a C program to convert binary to decimal number. We can easily write the C program to convert any given mixed binary number into decimal equivalent. To convert the binary number, we should multiply the each digits present in the binary number with their weights and add them (products) together to form the decimal equivalent. For Example: Let us find the decimal equivalent of binary number (101011.10111)2 using the below given converter program. The Given binary number: (101011.10111)2. The Decimal equivalent is calculated as: 1*2*2*2*2*2 + 0*2*2*2*2 + 1*2*2*2 + 0*2*2 + 1*2 + 1*1 + 1*1/2 + 0*1/(2*2) + 1*1/(2*2*2) + 1*1/(2*2*2*2) + 1*1/(2*2*2*2*2) = 43.71875 Decimal equivalent of (101011.10111) is (43.71875) The below given C program is used to convert a given mixed binary number into its equivalent decimal number. Kindly check out the program to convert binary number into its equivalent decimal number.