fork download
  1. #include<bits/stdc++.h>
  2. #define ll long long
  3. using namespace std;
  4. ll n,kq = 0;
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  8. freopen("TONGCHUSO.inp", "r", stdin);
  9. freopen("TONGCHUSO.out", "w", stdout);
  10. cin >> n;
  11. while(n != 0)
  12. {
  13. kq+=n%10;
  14. n/=10;
  15. }
  16. cout << kq;
  17. }
  18.  
Success #stdin #stdout 0s 5292KB
stdin
Standard input is empty
stdout
Standard output is empty