Question: Write a program in JAVA that accepts an input positive integer consisting of five digits from the user, separates the number into its individual digits
-
Write a program in JAVA that accepts an input positive integer consisting of five digits from the user, separates the number into its individual digits and prints the digits separated from one another by three spaces each. For example, if the user types in the number 42339, the program should print
4 2 3 3 9. Assume that the user enters the correct number of digits. What happens when you execute the program and type a number with more than five digits? What happens when you execute the program and type a number with fewer than five digits? How will you modify your program to ignore the numbers with digits not equal to five?
[Note: Dont convert the input integer into a String, you will lose points for that]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
