Im currently trying to make a program that prints the first 50 terms of the fibonnachi sequence. The Fibonacci sequence goes like this. 0,1,1,2,3,5,8,13 The Nth term is the sum of the previous two terms. So in the example above the next term would be 21 because it would be theprevious two terms added together (8+13).
my code currently does not display this could someone help me to understand why?
static void Main(string[] args)
{
int[] fibonnachi = new int[50];
fibonnachi[0] = 0;
fibonnachi[1] = 1;
int fib2ago = 0;
int fib1ago = 1;
for (int counter = 2; counter < 51; counter++)
{
fibonnachi[counter] = fibonnachi[fib2ago] + fibonnachi[fib1ago];
Console.Write(fibonnachi[counter] + " ,");
fib2ago++;
fib1ago++;
}
Console.ReadLine();
}