The program is giving run time error

here is the code https://ide.codingblocks.com/s/215874

Hi @pyash

n*20 might not give the nth prime number

make the primes array of the following order
int p[1000007] = {0};

void prime()
{
    p[0] = p[1] = 0;
    p[2] = 1;

    for (long long i = 3; i <= 1000005; i = i + 2)
        p[i] = 1;

    for (long long i = 3; i <= 1000005; i = i + 2)
    {
        if (p[i] == 1)
            for (long long j = i * i; j <= 1000005; j = j + i)
                p[j] = 0;
    }

}