Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.16 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int n;
  6.  
  7. int main()
  8. {
  9.     cin >> n;
  10.     int res = 0;
  11.     while (n) {
  12.         res += n%10;
  13.         n /= 10;
  14.     }
  15.     cout << res;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement