Implement Fibbonachi Functionality
This commit is contained in:
parent
be5588f02c
commit
cd1458b139
1 changed files with 24 additions and 0 deletions
24
Program.cs
Normal file
24
Program.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
|
||||
int amount;
|
||||
|
||||
ASK_INPUT:
|
||||
Console.WriteLine("Enter how many numbers you want to compute:");
|
||||
string input = Console.ReadLine();
|
||||
|
||||
if(!Int32.TryParse(input, out amount)){
|
||||
Console.WriteLine("Input Wasn't a Number!");
|
||||
goto ASK_INPUT;
|
||||
}
|
||||
|
||||
// Declare Variables used for Calculation
|
||||
System.Numerics.BigInteger themp;
|
||||
System.Numerics.BigInteger a = 1;
|
||||
System.Numerics.BigInteger b = 1;
|
||||
|
||||
for (int i = 1; i < amount + 1; i++)
|
||||
{
|
||||
Console.WriteLine($"{i}: {a}\n");
|
||||
themp = a;
|
||||
a = a + b;
|
||||
b = themp;
|
||||
}
|
Loading…
Reference in a new issue