解 基本操作,不多说 // // Created by 29273 on 2021-04-02. // #include "bits/stdc++.h" using namespace std; int main() { int n, num = 0; cin >> n; while (n) { num += n % 10; n /= 10; } cout << num << endl; return 0; }