Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int tab[10000001];
  4. int main()
  5. {
  6. int a;
  7. cin>>a;
  8. tab[0]=0;
  9. tab[1]=0;
  10. for (int i=2; i<1000000; i++)
  11. {
  12. tab[i]=1;
  13. }
  14. for (int j=0; j<1000000; j++)
  15. if(tab[j]==1)
  16. for (int k=2*j; k<1000000; k=k+j)
  17. {
  18. tab[k]=0;
  19. }
  20. if (tab[a]==1)
  21. {
  22. cout<<"pierwsza";
  23. }
  24. else
  25. cout<<"zlozona";
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement