write a program that will ask the user to enter a number, and then print out the individual defits of that number and the sum of those digits. use a methof for calculating the sum of the digits.
eg enter a number: 3146
the digits of 3145 are 6, 4, 1, 3
the sum of these digits are 14
i can do the sum, i just need help to separate the digits. i am not allowed to use an array, because we havnt lernt them yet, but i cant find any other way to do it
This post has been edited by Lowrie: 29 October 2005 - 10:59 AM

New Topic/Question
Reply



MultiQuote




|