• Log in or sign up for an account here: https://www.sythe.org/login

Need Some Help

wtp

Grand Master

Banned
Joined
Nov 25, 2005
Sythe Gold
0
Messages
2,455
Age
34
Location
Perth Amboy, NJ...Sorry no lame joke
Hey guys. I'm trying to do a programming lab for school.

205241_1770796324070_1664114223_1655446_7468953_n.jpg


How do I separate a number like 3456 to 3 4 5 and 6? I looked everywhere, but I can't find the answer, it's probably very simple.
 
Two Factor Authentication User
Sythe Awards 2011 Winner
Cook
Cool Kid
Former OMM
RsProd
Sythe Awards 2012 Winner
Village Drunk
divide string into char array, create new string, for each char do space...
 
Which code would I use to create an array?

You can use the regex split() and Integer valueOf() along with the scanner.

scan for input (input example: 1 2 3 4)
String numbers[] = input.split(" ");
convert to int using valueOf
add ints together to get sum.

Have fun!
 
Runescape Gamblingrunescape gambling
Back
Top