Advertisement
MeehoweCK

Untitled

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