Ошибка метода класса: "not all code paths return a value" - C#
Формулировка задачи:
{
public bool IsPrime(int x)
{
if (x <= 1)
return true;
for (int i = 2; i <= x / i; i++)
{
if ((x % i) == 0)
{
return false;
}
return true;
}
}Решение задачи: «Ошибка метода класса: "not all code paths return a value"»
textual
Листинг программы
public bool IsPrime(int x)
{
bool res=false;
if (x <= 1)
res= true;
for (int i = 2; i <= x / i; i++)
{
if ((x % i) == 0)
{
res= false;
break;
}
res= true;
}
return res;
}