Advertisement
H-a-y-K

Untitled

Nov 30th, 2020
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int prime_divisors(int num)
  4. {
  5.     int count = 0;
  6.  
  7.     for (int i = 2; i*i < num; i++)
  8.     {
  9.         if (num % i == 0)
  10.         {
  11.             bool isprime = true;
  12.  
  13.             for (int j = 2; j*j < i; j++)
  14.                 if (i % j == 0)
  15.                     isprime = false;
  16.  
  17.             if (isprime)
  18.                 count++;
  19.         }
  20.     }
  21.  
  22.     return count;
  23. }
  24.  
  25. int main() {
  26.   std::cout << prime_divisors(2*5*7);
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement