No prime number needs to be a whole number. If sqrt(n) is a whole number m, then n = m². n, therefore is not a prime number. m doesn't have to be prime number because m can be any numbers, prime or not prime, real or imaginary to satisfy the equation m² = n or m = sqrt(n).
You cannot use the square root to determine if it's a prime number or not. The square root only only used for the limit number factor of the number that the person inputted. For example: input = 100 10 = sqrt of 100 for(int i=2; i<=10; i++) { // check if i is one of the factors of the input number. } THIS IS THE CORRECT WAY.
again: No prime number needs to be a whole number. If sqrt(n) is a whole number m, then n = m². n, therefore is not a prime number. m doesn't have to be prime number because m can be any numbers, prime or not prime, real or imaginary to satisfy the equation m² = n or m = sqrt(n).