题解 | The Biggest Water Problem
The Biggest Water Problem
https://www.nowcoder.com/practice/435aa556e093463891f6da7d322140a4
#include <stdio.h> void judge(long long n) { long long a, sum=0; while (n) { a = n % 10; n = n / 10; sum += a; } if (sum < 10)//递归判断条件 { printf("%lld", sum); } else { judge(sum); } } int main() { long long n; scanf("%lld", &n); judge(n); return 0; }