Playing with stacks


Please point out the error.

I have made change in line 42 int i=n-1;

@aditi2512201012019 line 25-while(n–){
due to this part value of n will become zero,
line 42
for(int i=n;i>=0;i–){ instead of this you have to use
stacka;
while(!s.empty()){
and also you are printing the answer in wrong format

@aditi2512201012019 also your sieve function is wrong

what’s wrong with sieve program?

and what do I need to exactly change in line 42

as I am storing the primes in another array.

@aditi2512201012019

@aditi2512201012019 in your sieve function 4 is prime