Advertisement
MeehoweCK

Untitled

Feb 2nd, 2021
779
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. // ZADANIE 16
  6.  
  7. int suma_wartosci_cyfr(int liczba)
  8. {
  9.     if(liczba == 0)
  10.         return 0;
  11.     return liczba % 10 + suma_wartosci_cyfr(liczba / 10);
  12. }
  13.  
  14. int main()
  15. {
  16.     cout << suma_wartosci_cyfr(269745) << endl;
  17.  
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement