1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-12-16 15:44:39 +00:00
202401-programming-assignments/【实践课内】6.循环结构3/7-3 个位数.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;
}