a bit confuse about this java code
import java.util.Scanner; class PrimeCheck { public static void main(String args[]) { int temp; boolean isPrime=true; Scanner scan= new Scanner(System.in); System.out.println("Enter any number:"); //capture the input in an integer int num=scan.nextInt(); scan.close(); for(int i=2;i<=num/2;i++) { temp=num%i; if(temp==0) { isPrime=false; break; } } //If isPrime is true then the number is prime else not if(isPrime) System.out.println(num + " is a Prime Number"); else System.out.println(num + " is not a Prime Number"); } } ques : I am a bit confuse about the (for loop) why there is a i<=num/2 .. why num is divided by 2 .. like if my num is 10 diving it would be 5 which is a primal number right? while 10 is not.n on the next line num variable shouldn't be effected. but sill why divide by2