Question: In java Read in a four - digit integer from the user and print out each digit on a separate line, from the most significant
In java Read in a fourdigit integer from the user and print out each digit on a separate line, from the most significant leftmost one to the least significant rightmost You should use integer division and the modulo remainder operator to deconstruct the number and print it out piece by piece. You may use as many variables as youd like. You cannot convert the number into any other data type or use techniques beyond Chapter
Hint: the remainder of any number, when divided by is the rightmost digit. Eg is When divided by using integer division the quotient of any number is all the digits except the rightmost. Eg is
After you get the numberchopping part working, add input validation for the user input by adding an ifstatement. If the number you read is four digits, execute all the chopping code you wrote. If the number is less than four digits, print too small and end the program. If the number is larger than four digits, print too large and end the program. Hint: fourdigit numbers are at least and at most
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
