See what questions your friends are asking today.

What is recursion explain with example?

Answer:
Recursion is when a function (procedure) calls itself.
Example:

int Fib (int n)
{
if ((n==1)(n==0))return 1;
else return Fib(n-1) + Fib(n-2);
}

Contributors

«
LanceRas
Trust: 68
  • Computer Programming Supervisor
»

Top Contributors This Week

  • Trust Points: 2708
  • Member Since: 3/09
  • Trust Points: 4855
  • Member Since: 1/12
  • Trust Points: 2582
  • Member Since: 12/10
  • Trust Points: 10073
  • Member Since: 11/09
  • Trust Points: 3790
  • Member Since: 10/10