Hi All,
i have two arrays .how to find the correct febanacci Series Array.
Series:
int[] A = new int[5] {0,1,1,3,5};
int[] B = new int[5] {0,1,1,2,4};
Please give me a programe to find the correct febanacci array .
am using c#..
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vivek KumarPosted Apr 30, 2016, 8:35 AM
Bhuvanesh MohankumarPosted Apr 29, 2016, 7:41 AM
Create a actual Fibonacci series and compare with your values.
using System;
class Program
{
public static int Fibonacci(int n)
{
int a = 0;
int b = 1;
for (int i = 0; i < n; i++)
{
int temp = a;
a = b;
b = temp + b;
}
return a;
}
static void Main()
{
for (int i = 0; i < 15; i++)
{
Console.WriteLine(Fibonacci(i));
}
}
}