Advertisement
MeehoweCK

Untitled

May 1st, 2023
843
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. // wersja uproszczona:
  6. unsigned suma_dzielnikow_wlasciwych(unsigned n)
  7. {
  8.     if (n == 1)
  9.         return 0;
  10.     unsigned suma = 1;
  11.  
  12.     for (unsigned i = 2; i < n; ++i)
  13.         if (n % i == 0)
  14.             suma += i;
  15.     return suma;
  16. }
  17.  
  18. int main()
  19. {
  20.     cout << suma_dzielnikow_wlasciwych(999999999) << endl;
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement