Easy way to get 15 free YouTube views, likes and subscribers
Get Free YouTube Subscribers, Views and Likes

How To Convert Binary To Decimal Number using C++

Follow
it Tips

Source code is available here:
https://www.instms.com/cpp/examples/p...
Examples:
https://www.onlinemathcalculator.com/...
In today session we will learn the algorithm for binary to decimal conversion. Here we have first of all discuss the number systems and what is meant by base or radix of the number systems. For example we have taken a simple (10) number. This number is a binary number whose equivalent is 2 in decimal number system.
After attending the entire session we will enable to convert any number system into the decimal number system.
For conversion of any number from other number system to decimal number system we have to follow the following steps.
1. Get remainder of the number by 10 (Base of decimal number system)
2. Reduce the number by 10.
After getting the remainder from the number (This will provide us last digit) we have to add these remainder using the following formula.
dec = dec + rem * pow(2,i)
This formula line is discussed in detail in this session.
For simple understanding we take here two digit number. After compilation of the program we can provide it larger number input.

posted by klahu1e