Print prime function

In this function void print prime(int N){
for(i=2; i<=N;i++)
if we give the ending condition i++ while we are taking i<=N then at the last update For [i=N ] value we will get updated N+1 prime no. which is not possible practically to print.

please explain this logic to me
thankyou!!

@shivampant158 we are just iterating from 2 to N (both including) and checking if it is prime if yes then just printing it whats the doubt?

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.