Question: A non-recursive function called sumDigits) will sum up all the digits in a given number and then return this sum via reference. Here is that

 A non-recursive function called sumDigits) will sum up all the digits

in a given number and then return this sum via reference. Here

is that function defined non-recursively. 20 /on-recursive sum of digits 21 void

sumDigits (long& sum, long num) 22- 23, while (num>0){ 24 25 26

27 sum = sum + num%10 ; numnum/10; Here is the function

A non-recursive function called sumDigits) will sum up all the digits in a given number and then return this sum via reference. Here is that function defined non-recursively. 20 /on-recursive sum of digits 21 void sumDigits (long& sum, long num) 22- 23, while (num>0){ 24 25 26 27 sum = sum + num%10 ; numnum/10; Here is the function prototype 2 #include 4 using namespace std; 6 void sumDigits (long& sum, long num); 7

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!