digitSum
Category: Programming
Author: Stuart Reges
Book Chapter: 5.1
Problem: digitSum
Write a method digitSum that takes a non-negative integer as a parameter and that returns the sum of its digits. For example, digitSum(20879) should return 26 (2 + 0 + 8 + 7 + 9). You may assume that the method is passed a value greater than or equal to 0. You may not use a String to solve this problem; you must solve it using integer arithmetic. Write your solution to digitSum below.