Created
November 7, 2012 20:49
-
-
Save rofr/4034337 to your computer and use it in GitHub Desktop.
Fibonacci killer
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
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