View Single Post
Old 10-19-2005, 12:54 PM   #1 (permalink)
ZimbuTM
Registered User
 
Join Date: Sep 2005
Posts: 10
ZimbuTM is on a distinguished road
Is it necessary to use strings for this assignment?

We have to prompt the user for two integers m and n, then compute and print the sum of the digits of integers m TO n. Example:

1985 1991

1985 - 23
1986 - 24
1987 - 25
1988 - 26
1989 - 27
1990 - 19
1991 - 20

Will it be necessary to convert the integers to string and then use the charAt() method? Is there a simpler way to do this?

Just looking for a hint, no solutions please. Thanks.
ZimbuTM is offline   Reply With Quote