Doubt in the solution

in the for loop why is the condition n-1 and not n

Hi so a number is prime if it is divisible by 1 and number itself. so to check its prime or not we run a loop from 2 to n-1. if n is divisible by any i(from 2 to n-1) then the number is not prime else it is prime.
Hope it clears ur 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.