Https://ide.codingblocks.com/s/484710

I have done what u said but it is showing error again and tle so if i push more the limit of loop then also it will be tle so what i should do know.

Your mistakes

  1. p should be bool array as it contains only 0 or 1

  2. this loop is incorrect
    correct one
for ( long long int j = i * i; j <= 5000000; j += i)
			{
				p[j] = 0;
			}

check complete code below
Modified code

It is not working it is printing number upto the input number but not the amount of prime number said in the input

then you can count the prime nos using a for loop