¿Por qué recibo este error: no todas las rutas de código devuelven un valor?
hi soy nuevo en C # y estaba tratando de codificar pero obteniendo un error, ¿alguien puede ayudarme con esto? ¿Qué estoy haciendo mal?
using System;
using System.Collections.Generic;
using System.Text;
namespace hodder
{
class Program
{
public static void Main()
{
isHodder(3);
}
static int isHodder(int n)
{
int k = n;
for (int i = 2; i <= n / 2;i++ )
{
if ((n % 1) == 0)
{
return 0;
}
else
{
for (int j = 2; j <= k;j++ )
{
if (n == (2^ j) - 1)
{
return 1;
}
else
{
return 0;
}
k=(2^j)-1;
}
}
}
}
}
}
im error en "static int isHodder (int n)" 'hodder.Program.isHodder (int)': no todas las rutas de código devuelven un valor
y "Código inalcanzable detectado" en "k = (2 ^ j) -1"