- Calculate Fibonacci series numbers
Calculate Fibonacci series numbers
Create a C# program that uses recursion to calculate a number in the series of Fibonacci.
In the Fibonacci series, the series begins with the numbers 0 and 1, from these, each term is the sum of the previous two.
public class CalculateFibonacci
public static void Main(string args)
int n = Convert.ToInt32(Console.ReadLine());
public static int Fibonacci(int n)
if ((n == 1) || (n == 2))
return Fibonacci(n - 1) + Fibonacci(n - 2);