Created
August 13, 2025 08:41
-
-
Save rkttu/209a86bc63970116681443807104b963 to your computer and use it in GitHub Desktop.
Fibonacci calculation example (Top-Level statement style)
This file contains hidden or 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
| var n = 10; | |
| var fib = new List<long> { 0, 1, }; | |
| for (var i = 2; i < n; i++) | |
| fib.Add(fib[i - 1] + fib[i - 2]); | |
| Console.WriteLine($"Fibonacci sequence up to {n} terms:"); | |
| Console.WriteLine(string.Join(", ", fib)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment