(I'm assuming base 10 math) You could cheat. Convert the number to a string with no leading zeros. Capture the left most and right most characters of the string. Convert captured string variables back to integers. Add the integers. (Note: Consider a base string having a string length of 0 or 1.)
5
It appears that only single digit numbers work (0 thru 9)
Well, it's very hard to write a flowchart in text, so I'll give you some pseudo code instead. int number = the given number int sum = 0 loop while number is not 0 sum = sum + (number mod 10) number = number / 10
In QBASIC, you can write a simple program to input the number 64751315 and sum its digits as follows: DIM sum AS INTEGER sum = 0 INPUT "Enter a number: "; number FOR i = 1 TO LEN(number) sum = sum + VAL(MID$(number, i, 1)) NEXT PRINT "The sum of the digits is "; sum This program prompts the user to input a number, iterates through each digit, converts it to an integer, and adds it to the total sum, which is then printed out.
Peterson Number:145 = 1! + 4! + 5!number=sum of (factorials of digits)
If the sum of the digits of a given number equals nine or a multiple of nine, nine is a factor of that number.
12
It is another whole number.
82
81
There are several hundred of them. One example, the smallest, is 1039
36
0.1154
43
12
12
The number is 36.