11202: 5.2 求一个整数各位数字之和

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:2 Solved:0

Description

编写一个方法,计算一个整数各位数字之和:

public static int sumDigits(long n)

例如:sumDigits(long n) 返回92+3+4)。

Input

输入一个整数n

Output

输出一行

The sum of digits for n is 整数n各位数字之和

Sample Input Copy

234

Sample Output Copy

The sum of digits for 234 is 9