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
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
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
Sample Output 0
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
Sample Output 1
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
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images