big-o-notation/Exponential/Program.cs

22 lines
345 B
C#
Raw Permalink Normal View History

2024-10-04 13:20:48 +00:00
using System;
namespace Exponential
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine(fib(6));
}
static int fib(int num)
{
if (num <= 1) return num;
return fib(num - 2) + fib(num - 1);
}
}
}