Last active
November 30, 2022 06:29
-
-
Save Brianceasar/4cd9ef8ac993f39c86c71ab2c22c7bd1 to your computer and use it in GitHub Desktop.
Program that prints the first 100 members of the sequence of Fibonacci: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, …
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
namespace FibonacciSequence | |
{ | |
class Program | |
{ | |
static void Main() | |
{ | |
BigInteger newElement; | |
BigInteger[] sequenceMembers = { 0, 1 }; | |
Console.Write("{0},\n{1},\n", sequenceMembers[0], sequenceMembers[1]); | |
for (int i = 0; i < 98; i++) | |
{ | |
newElement = sequenceMembers[0] + sequenceMembers[1]; | |
Console.WriteLine("{0},",newElement); | |
sequenceMembers[0] = sequenceMembers[1]; | |
sequenceMembers[1] = newElement; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment