Prime number pseudocode

In the pseudo code of the prime no. , you didn’t mention anything for not prime. whether or not the while loop runs, the statement "print prime " will be executed as it is at the end of the while loop. So, it will prime every time even if no. is not a prime no.

THE correct pseudo code will be:::
read N
i <- 2
flag = 0
while i < N do :
if N is div by i :
flag = 1
print “NOT prime”
exit
end
i<- i+1
end
if flag == 0
print “Prime”
exit