hi im new to c# and was trying to code but getting error
can anybody help me with this what am i doing wrong?
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 getting error on " static int isHodder(int n) " 'hodder.Program.isHodder(int)': not all code paths return a value
and "Unreachable code detected " on "k=(2^j)-1"
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…