Created
December 30, 2016 02:44
-
-
Save dzsquared/3704140d18d860223c758e434747ab32 to your computer and use it in GitHub Desktop.
fib sequence created by dzsquared - https://repl.it/Exxp/0
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
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
class Solution { | |
static void Main(String[] args) { | |
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */ | |
string[] theInput = Console.ReadLine().Split(' '); | |
int howFar = Convert.ToInt32(theInput[2]); | |
ulong[] theResults = new UInt64[howFar+2]; | |
theResults[0] = Convert.ToUInt64(theInput[0]); | |
theResults[1] = Convert.ToUInt64(theInput[1]); | |
for(int i = 2; i <= howFar; i++) { | |
theResults[i] = theResults[i-2]+(theResults[i-1]*theResults[i-1]); | |
Console.WriteLine(theResults[i]); | |
} | |
Console.WriteLine(theResults[howFar-1]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment