Binary Conversion
Create a program that will convert a 4 bit binary number to a
decimal value (base 10).
1) Display the program header
2) Prompt the user to enter a 4 bit binary number and store it as a
string
3) Display a visual representation of the conversion (Hint: use
indexing)
4) Calculate the decimal value and display the result
Sample Output:
Your output should look SIMLAR like the one below.
Binary to Decimal Enter a 4 bit binary number Binary: 0110 0 2^3 1 2^2 1 2^1 + + + 2^0 Decimal: 6
Binary Conversion Create a program that will convert a 4 bit binary number to a decimal value (base 10). 1) Display the
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am