mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-11-23 15:48:42 +00:00
23 lines
248 B
C
23 lines
248 B
C
#include <stdio.h>
|
|
|
|
int main() {
|
|
int n;
|
|
|
|
scanf("%d", &n);
|
|
|
|
while (n >= 10) {
|
|
int s = 0;
|
|
|
|
while (n) {
|
|
s += n % 10;
|
|
n /= 10;
|
|
}
|
|
|
|
n = s;
|
|
}
|
|
|
|
printf("%d\n", n);
|
|
|
|
return 0;
|
|
}
|