Question: c++ programming Write a C++ program that defines and tests a function sumDigits(int n) that takes as an argument a positive integer n and returns
c++ programming

Write a C++ program that defines and tests a function sumDigits(int n) that takes as an argument a positive integer n and returns the sum of all the digits of n. Print both n and the sum of the digits. Your output should have the same format as the sample shown and should work for any positive integer a user enters. SAMPLE OUTPUT The value of n is: 257 The sum of all the digits is: 14
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
