changed the loop that calculates to the sum of the digits in an int to a fucntion