Advertisement
Guest User

Untitled

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