Java Help

+1 Nathan Pedersen · December 27, 2014
Been reading a text book on Java and have gotten to some exercises. I'm a complete beginner and was wanting some advice. I would rather an answer that points me in the right direction rather than giving me the straight up answer.

I need to write a program that takes a four-digit integer from the user and then prints it out on the screen one digit per line
for example: Input = 1993
The program should display it  as follows:
1
9
9
3

I believe I need to use arrays but am not quite sure. I'm using a Scanner for the user input but don't know how to assign each number to a separate variable, if that's even the way I should go about it. If anyone could help I would very much appreciate it. Thanks!

Post a Reply

Replies

Oldest  Newest  Rating
0 Stefan Gost · December 27, 2014
Ok a small hint:
use the modulus operator aka remainder. 

read something about it on google. If you need more help just ask.
  • 1

Java / Android Development

106,931 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator