标签:华为入职练习 华为oj
<pre name="code" class="cpp">#include <stdio.h> #include <stdlib.h> int main() { int n=0; while ( EOF != scanf("%d", &n) ) { int temp = n; int sum = n; do { temp = sum ; sum =0; while (0 != temp) { sum += temp % 10; temp /= 10; } } while (sum >= 10); printf("%d\n", sum); } return 0; }
标签:华为入职练习 华为oj
原文地址:http://blog.csdn.net/xiaohanstu/article/details/42293909