The purpose of this assignment is to assess if you can create a program that uses recursion.
The file must be called unit2Prog.cpp
Program Definition
1.Create program definition for sumDigits Function. Function will receive and return an integer.
Main Method
1.Ask for input for numerous non-negative integers.
2.Using pass-by-reference, pass integer received into recursive function called sumDigits.
3.Receive result back from sumDigits and output result to screen.
4.Include: system("PAUSE"); after your output to pause the screen. See example below.
sumDigits Function (Receives integer)
1.Recursively call sumDigits adding up the integers received.
2.Return result to main method for output.
3.If a single digit is received, just return it to the main method.
Ensure you include ALL .cpp file(s) and any associated, student-defined .h (header) files required to make your program compile and run. The only files in the dropbox should be .cpp and .h files. Do not turn in .zip, .exe, .rar, etc files.
Example output of your program
Run 1:
Enter a nonnegative integer: 23
The sum of the digits of 23 is 5
Run 2:
Enter a nonnegative integer: 1234
The sum of the digits of 1234 is 10
Run 3:
Enter a nonnegative integer: 90513
The sum of the digits of 90513 is 18
Run 4:
Enter a nonnegative integer: 2147483647
The sum of the digits of 2147483647 is 46