public class IsPrime
{
public static bool isPrime(int x)
{
if (x <= 1)
return false;
for (int i = 2; i <= Convert.ToInt32(Math.Sqrt(x)); ++i)
if ((x % i) == 0)
return false;
return true;
}
}
No comments:
Post a Comment