Advertisement
STANAANDREY

zzzzzzzzz

Jan 14th, 2019
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main ()
  7. {
  8.  
  9. unsigned n,d,nrdp=0,prim,i;
  10.  
  11. cout<<"n=";cin>>n;
  12.  
  13. d=2;
  14.     while (d<=n/2)
  15. {
  16.     if (n%d==0)
  17.     {
  18.         prim=1;i=2;
  19.       while (i<=d/2)
  20.         {
  21.          if (d%i==0)
  22.             prim=0;
  23.             i++;
  24.         }
  25.         if (prim)
  26.             nrdp++;
  27.     }
  28.   d++;
  29. }
  30.  
  31. cout<<nrdp;
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement