Question 3: Implement an algorithm [10]

Part 1: use the following algorithm to implement a function, digitSum, that finds the sum of all the digits in a positive integer. For example, if the number is 478, the function should calculate that 4+7+8=19 and return 19.

   sum = 0
   repeat until input = 0
      add the last digit of input to sum
      remove the last digit from sum
   once the loop completes return sum
Part 2: It is possible to determine if a number is divisible by 9, by calling digit sum on the number repeatedly until the result is a 1 digit number. If that number is 9 then the number is a multiple of 9, otherwise it is not.

Write a complete and correct C++ program that takes a positive integer as a command line argument and displays "9 multiple" if it is a multiple of 9, or "Not 9" if it is not.

Your program must have at least three functions: digitSum, nineMultiple, and main.