Advertisement
StoneHaos

358

Nov 2nd, 2019
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. //358
  2. #include <iostream>
  3. #include <cstdio>
  4. using namespace std;
  5.  
  6. int main(void) {
  7.     freopen("input.txt", "r", stdin);
  8.     freopen("output.txt", "w", stdout);
  9.  
  10.     int n, sum = 0;
  11.     cin >> n;
  12.     sum += n % 10;
  13.     n /= 10;
  14.     sum += n % 10;
  15.     sum += n / 10;
  16.     cout << sum << "\n";
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement