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: 2705
  • Member Since: 3/09
  • Trust Points: 2568
  • Member Since: 12/10
  • Trust Points: 10063
  • Member Since: 11/09
  • Trust Points: 1873
  • Member Since: 9/09
  • Trust Points: 4843
  • Member Since: 1/12