in this program I just want to know that 2 to n-1 is taken as a particular no I or what for it is please explain me the full program in detail
Prime no checker
In this video, we are just checking if a number is prime or not. The condition for a number to be prime is that it should not have any divisors other than 1 and the number itself. So that’s why we’re checking for numbers in the range 2 to n-1. If we find any divisor in this range, the number will be prime.
that I understand I want to know why I has been taken here
i is a variable which will be used in the for loop to iterate over the range. Only then we can check n%i, right?