Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "Russian");
- const int N =100;
- bool a[N + 1];
- for(int i=2; i<N+1 ;i++)
- a[i] = true;
- for (int i = 2; i <= N; i++)
- {
- if (a[i])
- {
- for (int j = i*i; j <= N; j += i)
- a[j] = false;
- }
- }
- for (int i = 2; i < N + 1; i++)
- if (a[i])
- cout <<"масив" <<i << endl;
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement