Demo entry 5853524

   

Submitted by anonymous on Jul 20, 2016 at 13:42
Language: C++. Code size: 399 Bytes.

#include<iostream>
#include<cstdio>
using namespace std;

#define MAXN 100001

int prime[MAXN];

void isprime(){
	prime[1] = 1;
	prime[2] = 0;
	for(int i = 2; i < 100000 ; i ++){
		if(!prime[i]){
			for(int j = i+i ; j < 100000 ; j += i ){
				prime[j] = 1;
			}
		}
	}
}

int main(void){
	isprime();
	for(int i = 1 ; i <= 100 ; i ++){
		if(!prime[i])
		cout<<i<<endl;
	}
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).