hi everyone, i have being working on this code for a long time.. but couldnt make it right

it is simple find the prime number from the user inputs

this is the code ....

but this is not the exact code that i want ...Code:bool IsPrime(int iNum) { // Check if i is less than square root of iNum (and cast iNum to type double) for (int i=2; i<=sqrt((double)iNum); i++) { if (iNum == ((int)iNum/i)*i)// (inum%i == 0) return false; } return true; }

my aim is to find the prime number that the user will input the max number,,,

example here:

input: 4

output will be: not prime..

please help ...... i know there are lot of related topic but .... still couldnt help.