这真是一道大水题
两个wheil
#include<iostream>
using namespace std;
int main() {
int n;cin >> n;
int ans = 0;
while (n >= 10) {
while (n) {
ans += n % 10;
n /= 10;
}
n = ans;
ans = 0;
}
cout << n << endl;
return 0;
}
这真是一道大水题
两个wheil
#include<iostream>
using namespace std;
int main() {
int n;cin >> n;
int ans = 0;
while (n >= 10) {
while (n) {
ans += n % 10;
n /= 10;
}
n = ans;
ans = 0;
}
cout << n << endl;
return 0;
}