解题思路:
注意事项:
参考代码:
#include <stdio.h>
int main(void)
{
int i, tom, digit;
unsigned long n;
while(scanf("%lu",&n)==1)
{
tom=0;
while (n != 0)
{
digit = n % 10;
n = n / 10;
tom = tom + digit;
}
printf("%d\n", tom);
}
return 0;
}
0.0分
0 人评分
C二级辅导-计负均正 (C语言代码)浏览:1202 |
C语言程序设计教程(第三版)课后习题7.2 (C语言代码)浏览:529 |
陶陶摘苹果 (C语言代码)浏览:1607 |
校门外的树 (C语言代码)浏览:1124 |
C语言程序设计教程(第三版)课后习题11.5 (C语言代码)浏览:629 |
输出正反三角形 (C语言代码)格式错误!!!浏览:1141 |
C语言训练-阶乘和数* (C语言代码)-------- 呆板写法浏览:1362 |
C语言训练-大、小写问题 (C语言代码)浏览:732 |
简单的for循环浏览:1412 |
字符逆序 (C语言代码)浏览:646 |