Fibonacci Ienumerable

55

Fibonacci Ienumerable -

static IEnumerable<int> Fibonacci()
{
    int current = 1, next = 1;

    while (true)
    {
        yield return current;
        next = current + (current = next);
    }
}

Comments

Submit
0 Comments