hi , urm... i am practising c# console application , and am trying to get the function to verify if the number appears in a fibonacci series or not but im getting errors
what i did was
class Program
{
static void Main(string[] args)
{
System.Console.WriteLine(isFibonacci(20));
}
static int isFibonacci(int n)
{
int[] fib = new int[100];
fib[0] = 1;
fib[1] = 1;
for (int i = 2; i <= 100; i++)
{
fib[i] = fib[i - 1] + fib[i - 2];
if (n == fib[i])
{
return 1;
}
}
return 0;
}
}
can anybody tell me what am i doing wrong here.....