Question: Using a while loop and if-else statements if required, write a function file that will add (sum) the DIGITS of any number entered. Your function

 Using a while loop and if-else statements if required, write a

Using a while loop and if-else statements if required, write a function file that will add (sum) the DIGITS of any number entered. Your function should get the number (scalar) as an input 2. argument and return the sum as an output argument. You may use any of the following built-in functions to assist you: ceil, floor, round, fix, rem, or mod. HINT: What number do you need to divide by to get a single digit out of a long number? How do you keep track of what is left after the division? Here is an example of what the input and output should look like: Input number: 123456789 Output: 45 Test your code using: 98765 and 100001

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!