Advertisement
Guest User

Untitled

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