Skip to content

Instantly share code, notes, and snippets.

@fischgeek
Created March 23, 2020 21:58
Show Gist options
  • Save fischgeek/67b4e6f9d7b8a2d60105fe7b97fd7157 to your computer and use it in GitHub Desktop.
Save fischgeek/67b4e6f9d7b8a2d60105fe7b97fd7157 to your computer and use it in GitHub Desktop.
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