Question: C++ program plz help! For the function part, if you enter 123, you should first 123/10 to get 12, 123%10 to get 3, 12/10 to

 C++ program plz help! For the function part, if you enter

123, you should first 123/10 to get 12, 123%10 to get 3,

C++ program plz help! For the function part, if you enter 123, you should first 123/10 to get 12, 123%10 to get 3, 12/10 to get 1 and 12%10 to get 2 and then add 1 ,2, and 3 up to get 6.

Exercise 1 Write a function called SumDigits that takes in an INTEGER parameter and computes and returns the sum of its digits. If the incoming integer is negative, then disregard the negative (and still compute the sum of the digits, as a positive result). 1. This function should not depend on any LIMIT to the number of digits. Assume no limit to how many digits a number can have (remember the range of an int depends on the computer architecture-- it differs for different machines the function should work for any number of digits). o To test this function, write a main() routine that enters a loop, in which the user is prompted and allowed to enter any integer (0 to exit the loop), and the integer is sent to the function and the result printed. The user should keep being asked for inputs until they type a 0 to exit. 2. NOTE: You may not not use strings anywhere in this lab. So no converting the int to a string

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!