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