Skip to content

Instantly share code, notes, and snippets.

@IEvangelist
Created May 3, 2021 16:07
Show Gist options
  • Save IEvangelist/d37531b0ae783a85d9d98771ce35ece0 to your computer and use it in GitHub Desktop.
Save IEvangelist/d37531b0ae783a85d9d98771ce35ece0 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
static IEnumerable<int> Fibonacci(int max)
{
int current = 1, next = 1;
while (current < max)
{
yield return current;
next = current + (current = next);
}
}
Console.WriteLine(string.Join("", Fibonacci(200)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment