Alternatively, you can convert the String to int. Then use the % and / to extract the int value as suggested in this thread.
Joyce [ October 31, 2004: Message edited by: Joyce Lee ]
Joined: Oct 31, 2004
okk thankx for the loop!, but in an array how would i add the value? beacsue i need to get the total value of the number the user enteres and then i have to see if its % 10 and if it not i have to make it %10.... i konw n+n wont work beacsue its just gonna add n to the same number.
Joined: Jul 11, 2003
If you're trying to add up the individual digit of a number, you don't need to store them in an array.
After getting the sum, you can find the remainder for (sum / 10) by using % operator.
i konw n+n wont work beacsue its just gonna add n to the same number. Could you show us the code? Maybe we can point out the mistakes (if there's any) for you.
Joyce [ November 01, 2004: Message edited by: Joyce Lee ]