Created
March 23, 2020 21:58
-
-
Save fischgeek/67b4e6f9d7b8a2d60105fe7b97fd7157 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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var iter = rl("Iterations:"); | |
var iterInt = Convert.ToInt32(iter); | |
long val1 = 0; | |
long val2 = 1; | |
for (int i = 1; i < iterInt; i++) { | |
long calc = val1 + val2; | |
if (i == iterInt-1) { | |
w(calc); | |
} else { | |
w(calc, ","); | |
} | |
val1 = val2; | |
val2 = calc; | |
} | |
wl(""); | |
rl("press any key to exit"); | |
} | |
static void w(long txt, string separator = "") => Console.Write(txt.ToString() + separator); | |
static void wl(string txt) => Console.WriteLine(txt); | |
static void wl(int txt) => Console.WriteLine(txt.ToString()); | |
static string rl(string txt) | |
{ | |
wl(txt); | |
return Console.ReadLine(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment