Question: Write a program that asks the user for an 8 digit binary number and then uses another method that converts the binary number into a
Write a program that asks the user for an 8 digit binary number and then uses another method that converts the binary number into a decimal number. You will have to build the manual calculation. The program should only accept an 8 digit binary number and should vailidate against anything except 1's and 0's from the input.
A lesson in binary:
Binary is base 2, while decimal is base 10. The smallest digit is all the way to the right, and it's based on powers of 2 instead of powers of 10. For 8 digit binary numbers, the sequence conversion to decimal is as follows:
BINARY 1 1 1 1 1 1 1 1
Conversion 2^7 + 2^6 + 2^5 + 2^4 + 2^3 + 2^2 + 2^1 + 2^0
DECIMAL 128
BINARY 1 1 0 0 1 1 1 1
Conversion 2^7 + 2^6 + 0 + 0 + 2^3 + 2^2 + 2^1 + 2^0
DECIMAL 207
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
