1028: Tom数
Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 648 Solved: 306[][][]Description
正整数的各位数字之和被Tom称为Tom数。求输入数(<2^32)的Tom数!
Input
每行一个整数(<2^32).
Output
每行一个输出,对应该数的各位数之和.
Sample Input
12345 56123 82
Sample Output
15 17 10
HINT
s[i]-'0'可将字符串转成数字
#include#include int main(){ int n; char s[1001]; while(scanf("%s",&s)!=EOF) { int a=0; n=strlen(s); for(int i=0; i