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. The Main program should prompt the user for input.

A sample output is shown 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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!