Description
Write a function that computes the sum of the digits in an integer. Use the following function header:
int sumDigits(long n)
For example, sumDigits(234) returns (9)
// Date:2020/3/28
// Author:xiezhg5
int sumDigits(long n)
{
if(n<0)
n=-n;
int i,sum=0;
while(n/10!=0)
{
i=n%10;
sum=sum+i;
n=n/10;
}
sum=sum+n;
return sum;
}