Advertisement
Guest User

liczby_pierwsze

a guest
Oct 26th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. #include <stdio.h>
  4. #include <conio.h>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     for (int i=2; i<1000; i++)
  11.     {
  12.         bool pierwsza = true;
  13.  
  14.         for(int j = 2; j*j<=i; j++)
  15.         {
  16.             if(i % j == 0)
  17.             {
  18.             pierwsza = false;
  19.             break;
  20.             }
  21.         }
  22.         if(pierwsza) cout<<i<<" ";
  23.     }
  24.     return 42;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement