C Program to Convert Binary to Decimal Number

In this tutorial, we will explain a simple program which will convert the number from binary to the decimal number system. We have not used any validation in number input as this program is designed for the beginners for learning purpose.

You can modify this program to validate the number entered by the user during the program execution time, then the user can only enter the binary number in the combination of (0, 1).

Algorithm to convert from binary to decimal number

Below is the algorithm of number conversion from binary to decimal.

  1. Accept Number from User as 0,1
  2. Divide number by 10 and store remainder in variable temp
  3. Again divide the original number by 10.
  4. Then calculate the sum of number to get the decimal.

Binary to Decimal number Conversion using c Programming language

Copy the below c program and execute it with c compiler to see the output of the program and also start converting the number system from binary number to decimal number.

Program Input/Output:

#First try
Enter the Binary number (0 and 1) : 101
Decimal number : 5
#Second try
Enter the Binary number (0 and 1): 111011
Decimal number : 59

Recommended Posts:


Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of FreeWebMentor.com (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.

Article Tags: , , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Solved Programs