Advertisement
STANAANDREY

superprim

Dec 8th, 2018
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main ()
  6. {
  7.  
  8. long long n,d=2,nreprim=1,i=2,j=2,eprim,poz=0,d2=2,pozepr=1;
  9. cin>>n;
  10.  
  11. while (d<=n/2&&nreprim==1)
  12. {
  13.     if (n%d==0)
  14.        nreprim=0;
  15.     d++;
  16. }
  17.  
  18. while (i<=n)
  19. {
  20.     eprim=1;
  21.     while (j<=i/2&&eprim==1)
  22.     { if (i%j==0)
  23.         eprim=0;
  24.         j++;
  25.     }
  26.     i++;
  27.     if (eprim)
  28.         poz++;
  29.  
  30. }
  31.  
  32. while (d2<=poz/2)
  33. {
  34.     if (poz%d2==0)
  35.     pozepr=0;
  36.     d2++;
  37.  
  38. }
  39.  
  40. if (pozepr==1&&nreprim==1)
  41.     cout<<"Da";
  42. else
  43.     cout<<"Nu";
  44.  
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement