hi im new to java and just need a little help in the right direction. I am trying to display an input of int on number at a time. So for example the user would enter 1998 and the output would be:
1
9
9
8
and we have to use the operators / and %. I know that % is to show the remainder but it just doesn't make sense to me how they could output that on each line. I have tried solving this using just / and - but it doesn't work. Also the input can only be a 4 digit Int
Create five variables, all integers. Have a variable called
year that stores 1998. Have four more variables:
thousands ,
hundreds ,
tens ,
ones . If
year = 1998, use the / and % operators to put the proper value into each variable so that
thousands = 1,
hundreds = 9,
tens = 9,
ones = 8, then display them with 4 separate
println commands.
Last edited by VernonDozier; Sep 23rd, 2008 at 7:31 pm.
Reputation Points: 2614
Solved Threads: 687
Posting Expert
Offline 5,374 posts
since Jan 2008