#include < iostream > #include < cmath > using namespace std; int main( int ac, char ** av) ... { const MAX = 100; bool sieve[MAX + 1]; fill(sieve, sieve + MAX + 1, true); sieve[0] = false; sieve[1] = false; for (int n=2; n < sqrt((double)MAX + 1); n++) ...{ if (sieve[n]) ...{ for (int j=2*n; j < MAX + 1; j+=n) sieve[j] = false; } } for(int i = 2; i < MAX + 1; i++) ...{ if(sieve[i]) cout << i << endl; } getchar();}