i am having trouble fixing this program... its not printing the number any tips???
i am using sieve of Eratosthenes
#include <cstdio>
#include "simpio.h"
#include "strlib.h"
#include <iostream>
using namespace std;
int main()
{
bool is_prime[300];
int num[300];
int i, n;
printf("This program prints all prime numbers from 1 to 300.\n");
// Identifing the numbers
for (i = 0; i<=300; i++)
{
is_prime[i] = true;
num[i] = i;
}
is_prime[0] = false;
is_prime[1] = false;
//Identifing the non prime
for(i = 1; i<=300; i++)
{
for(n = i; n<=300;)
{
is_prime[n] = false;
n = n*2;
}
}
//Displaying numbers
for(n = 0; n<=300; n++)
{
if (is_prime[n] == true)
{
printf("%d\n",num[n]);
}
}
//Pausing program
system("pause");
}