```
using System;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
for (Byte n = 0; n < 20; n++)
{
Console.WriteLine("F({0}) = {1}", n, Fib(n));
}
Console.ReadKey();
}
/// <summary>
/// Calculates the Nth(starting from zero) Fibonacci number
/// no overflow error checking
/// </summary>
/// <param name="n">n can range from 0 to 93</param>
/// <returns>F(n)</returns>
public static UInt64 Fib(Byte n)
{
double sqrt5 = Math.Sqrt(5);
double phi = (sqrt5 + 1) / 2;
return Convert.ToUInt64((1 / sqrt5) * Math.Pow(phi, n));
}
}
}
```

**Are you able to help answer this sponsored question?**

Questions asked by members who have earned a lot of community kudos are featured in order to give back and encourage quality replies.

Recommended Topics