Enter a decimal


Chapter 3 Exercise 35
HEX.
(Decimal to hex) Write a program that prompts the user to enter an integer between 0 and 15 and displays its corresponding hex number.

INPUT and PROMPTS. The program prompts for a integer with: "Enter a decimal value (0 to 15): ".

OUTPUT . If the integer read in is equal to the value of a single hexadecimal digit (i.e. in the range specified by the prompt), the program prints out "The hex value is x", where x is the hexadecimal digit corresponding to the input; otherwise it prints the message "Invalid input".

CLASS NAMES. Your program class should be called He

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Enter a decimal
Reference No:- TGS0628693

Now Priced at $25 (50% Discount)

Recommended (91%)

Rated (4.3/5)