Advertisement
MeehoweCK

Untitled

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