Skip to content

Instantly share code, notes, and snippets.

@rofr
Created November 7, 2012 20:49
Show Gist options
  • Save rofr/4034337 to your computer and use it in GitHub Desktop.
Save rofr/4034337 to your computer and use it in GitHub Desktop.
Fibonacci killer
using System;
public class FibonacciKillerKata : IFibonacciKillerKata
{
public int Fibonacci(int n)
{
if (n <= 1) return n;
else return Fibonacci(n-1) + Fibonacci(n-2);
}
}
public interface IFibonacciKillerKata
{
/// <summary>
/// Calculate an element of the Fibonacci sequence
/// </summary>
/// <param name="n">element number</param>
/// <returns>n-th element of the Fibonacci sequence</returns>
int Fibonacci(int n);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment