~cpp
#include <iostream.h>
#include <math.h>
#include <time.h>
int main()
{
int tmp_arr[10000]={2,0};
int cur_arr_index = 1;
int i,j;
bool flag;
clock_t t = clock();
for(i=3; i<50000; i++) {
flag = true;
for(j=0; tmp_arr[j]<=sqrt(i); j++)
//for(j=0; j<cur_arr_index; j++)
{
if(i%tmp_arr[j]==0) {
flag=false;
break;
}
else continue;
}
if(flag) tmp_arr[cur_arr_index++]=i;
}
/*double ti = clock()-t;
double clk = CLOCKS_PER_SEC;
cout << ti/clk << endl;*/
/*for(i=0; i<cur_arr_index; i++)
cout << tmp_arr[i] << ' ';*/
double ti = clock()-t;
double clk = CLOCKS_PER_SEC;
cout << ti/clk << endl;
return 0;
}