Display a given a decimal value in every base from 2 (binary) through 16 (hexadecimal). Input Format You will be given a single positive whole decimal number. Constraints The number will be between 2 and 2^63-1 (Long.MAX_VALUE) Output Format output 15 lines. One line for each base from 2 through 16. On each line print the number in base 10 and it's equivalent representation in the base for the line. Note: the examples will show your output format. Sample Input 0 16 Sample Output 0 16 in base 10 equals 10000 in base 2.16 in base 10 equals 121 in base 3.16 in base 10 equals 100 in base 4.16 in base 10 equals 31 in base 5.16 in base 10 equals 24 in base 6.16 in base 10 equals 22 in base 7.16 in base 10 equals 20 in base 8.16 in base 10 equals 17 in base 9.16 in base 10 equals 16 in base 10.16 in base 10 equals 15 in base 11.16 in base 10 equals 14 in base 12.16 in base 10 equals 13 in base 13.16 in base 10 equals 12 in base 14.16 in base 10 equals 11 in base 15.16 in base 10 equals 10 in base 16. Explanation 0 Check with the programmer version of your calculator - The mode that shows the value in several bases. Note that each line of the output is an english sentence ending with a period. Match the output. Sample Input 1 63 Sample Output 1 63 in base 10 equals 111111 in base 2.63 in base 10 equals 2100 in base 3.63 in base 10 equals 333 in base 4.63 in base 10 equals 223 in base 5.63 in base 10 equals 143 in base 6.63 in base 10 equals 120 in base 7.63 in base 10 equals 77 in base 8.63 in base 10 equals 70 in base 9.63 in base 10 equals 63 in base 10.63 in base 10 equals 58 in base 11.63 in base 10 equals 53 in base 12.63 in base 10 equals 4B in base 13.63 in base 10 equals 47 in base 14.63 in base 10 equals 43 in base 15.63 in base 10 equals 3F in base 16. Explanation 1 Note there are no indicators in your output value as to what the base is. i.e. We output 3F for 63 in base 16. You may have seen a typical notation of 0x3Fh or something similar Also note that the hexadecimal digits (A-F) are UPPERCASE     I need code  in java

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 21PE
icon
Related questions
icon
Concept explainers
Question

Display a given a decimal value in every base from 2 (binary) through 16 (hexadecimal).

Input Format

You will be given a single positive whole decimal number.

Constraints

The number will be between 2 and 2^63-1 (Long.MAX_VALUE)

Output Format

output 15 lines.
One line for each base from 2 through 16.
On each line print the number in base 10 and it's equivalent representation in the base for the line.
Note: the examples will show your output format.

Sample Input 0

16

Sample Output 0

16 in base 10 equals 10000 in base 2.16 in base 10 equals 121 in base 3.16 in base 10 equals 100 in base 4.16 in base 10 equals 31 in base 5.16 in base 10 equals 24 in base 6.16 in base 10 equals 22 in base 7.16 in base 10 equals 20 in base 8.16 in base 10 equals 17 in base 9.16 in base 10 equals 16 in base 10.16 in base 10 equals 15 in base 11.16 in base 10 equals 14 in base 12.16 in base 10 equals 13 in base 13.16 in base 10 equals 12 in base 14.16 in base 10 equals 11 in base 15.16 in base 10 equals 10 in base 16.

Explanation 0

Check with the programmer version of your calculator - The mode that shows the value in several bases.
Note that each line of the output is an english sentence ending with a period. Match the output.

Sample Input 1

63

Sample Output 1

63 in base 10 equals 111111 in base 2.63 in base 10 equals 2100 in base 3.63 in base 10 equals 333 in base 4.63 in base 10 equals 223 in base 5.63 in base 10 equals 143 in base 6.63 in base 10 equals 120 in base 7.63 in base 10 equals 77 in base 8.63 in base 10 equals 70 in base 9.63 in base 10 equals 63 in base 10.63 in base 10 equals 58 in base 11.63 in base 10 equals 53 in base 12.63 in base 10 equals 4B in base 13.63 in base 10 equals 47 in base 14.63 in base 10 equals 43 in base 15.63 in base 10 equals 3F in base 16.

Explanation 1

Note there are no indicators in your output value as to what the base is.
i.e. We output 3F for 63 in base 16. You may have seen a typical notation of 0x3Fh or something similar
Also note that the hexadecimal digits (A-F) are UPPERCASE    

I need code  in java 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr