public class look
{
public int takeALook (int a)
{
if (a == 1)
return 1;
else if (a == 0)
return 0;
else
return takeALook(a-2) + takeALook(a-1);
}
}
Main program,
int a = 6;
look lk = new look();
int r = lk.takeALook(a);
Console.WriteLine("r is" + r);
the answer is 8. but can anyone please explain why? It’s confusing me because it is calling itself 2x.
1 Answer