Advertisement
Sammy24

Untitled

Apr 7th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7.  
  8. void nr_div_imp(int n, int &div)
  9. {
  10. div = 0;
  11. int d;
  12.  
  13. if(n % 2 == 1)
  14. {
  15. div++;
  16. }
  17.  
  18. for(d = 3; d * d < n; d += 2)
  19. {
  20. if(n % d == 0)
  21. {
  22. div++;
  23. }
  24.  
  25. if(n % (n / d) == 0 && (n / d % 2 == 1))
  26. {
  27. div++;
  28. }
  29. }
  30.  
  31. if(d % 2 == 1 && d * d == n)
  32. {
  33. div++;
  34. }
  35.  
  36.  
  37. return;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement