解题思路:
注意事项:
参考代码:
#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语言代码)浏览:608 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:533 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:660 |
用筛法求之N内的素数。 (C语言代码)浏览:803 |
C语言程序设计教程(第三版)课后习题5.6 (C语言代码)浏览:531 |
母牛的故事 (C语言代码)浏览:549 |
时间转换 (C语言代码)浏览:627 |
前10名 (C语言代码)浏览:727 |
复数求和 (C语言代码)浏览:920 |
敲七 (C++代码)浏览:1053 |