Question
Use for loop, while loop, and do while loops to generate a table of decimal numbers, as well as the binary, octal, and hexadecimal equivalents
Use for loop, while loop, and do while loops to generate a table of decimal numbers, as well as the binary, octal, and hexadecimal equivalents of the decimal numbers, in the range 1-256. Note: See Appendix for number systems. The program should print the results to the Console without using any string formats . Design Details:
The Main program should prompt the user for input. The output is shown in the sample output below. Note: To generate the binary numbers your code should use a while loop to generate the binary numbers, a for loop to generate the octal numbers and a do .. while to generate the hexadecimal numbers. Sample Output: Enter the low number: 1 Enter the high number: 10 Decimal Binary Octal Hexadecimal 1 1 1 1 2 10 2 2 3 11 3 3 4 100 4 4 5 101 5 5 6 110 6 6 7 111 7 7 8 1000 10 8 9 1001 11 9 10 1010 12 A ****Resetting low and high **** Low = 10, High = 15 Decimal Binary Octal hexadecimal 10 1010 12 A 11 1011 13 B 12 1100 14 C 13 1101 15 D 14 1110 16 E 15 1111 17 F Press any key to continue . . .
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started