Created
May 3, 2021 16:07
-
-
Save IEvangelist/d37531b0ae783a85d9d98771ce35ece0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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