Write a program that prompts the user to input an integer | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Write a program that prompts the user to input an integer

Write a program that prompts the user to input an integer between 0 and 35. If the number is less than or equal to 9, the program should output the number; otherwise, it should output A for 10, B for 11, C for 12, . . ., and Z for 35. (Hint: Use the cast operator, (char)( ), for numbers >= 10.) i can solve the problem without using cast operater (char) but i am curious how it would be done with this operater... any help would be helpful 😊😁

28th Jan 2020, 2:43 PM
sameer
sameer - avatar
1 Answer
+ 1
This will do- System.out.println((char)(55+num));
28th Jan 2020, 2:55 PM
Avinesh
Avinesh - avatar