Fibonacci using Recursive
public static void Main(string[] args)
{
//Your code goes here
for(int i=1; i<=7; i++)
{
Console.Write(fibonacci(i) + " ");
}
}
In every single loop, we call fibonacci function that will adding number with recursive method.
public static int fibonacci(int angka)
{
if(angka <= 1)
{
return angka;
}
else
{
return fibonacci(angka-1) + fibonacci (angka-2);
}
}