suite fibonacci C#

PHOTO EMBED

Mon Nov 16 2020 22:38:12 GMT+0000 (Coordinated Universal Time)

Saved by @bifrost #c#

var fibonacciNumbers = new List<int> {1, 1};

while (fibonacciNumbers.Count < 20)
{
    var previous = fibonacciNumbers[fibonacciNumbers.Count - 1];
    var previous2 = fibonacciNumbers[fibonacciNumbers.Count - 2];

    fibonacciNumbers.Add(previous + previous2);
}
foreach(var item in fibonacciNumbers)
    Console.WriteLine(item);
content_copyCOPY