What is recursion explain with example?

Recursion is when a function (procedure) calls itself.

int Fib (int n)
if ((n==1)(n==0))return 1;
else return Fib(n-1) + Fib(n-2);
+ 22 others found this useful
Thanks for the feedback!

Do you ever get writer's block? If so, what do you do to overcome it?

View Full Interview

Explain events in VB with an example?

Make a form. Go to its events tab. Double click on the text that says: "FormClosing". You should be taken to the code to Form1_FormClosing(). Under here, write MsgBox("Window (MORE)
In Bonds

Basics of Treasury Bonds and Securities Explained

Choosing the right investment is never an easy decision. What is the safest route? What is likely to yield the greatest return with the smallest risk? Are treasury bonds safe? (MORE)
In History

A Very Short Explanation of the Internet

It may seem strange, but sometimes there is a need to explain something that is so ubiquitous that you might think that it does not need an explanation. However, to explain th (MORE)

Explaining Asperger's Syndrome to Your Other Children

Having a child with Asperger's Syndrome means dealing with the reactions that follow his unusual physical and social movements. Explaining Asperger's to children helps them un (MORE)

Autism Awareness: Explaining Autism to Young Children

Explaining autism to children is a necessary part of introducing children to social situations, such as those they encounter in the park, at school or in clubs. Autism is a ve (MORE)
In Physics

Explain the process of refraction and an example?

Refraction is the phenomena that occurs when a ray of light changes direction when it passes through a medium with a different refractive index. This is observable as by subm (MORE)

Can Explain with an example to the default constructor?

The following example shows a Lamborghini class with two constructors: class Lamborghini { Lamborghini() { } Lamborghini(String name) { } } Will the compiler put in (MORE)

Write a example of recursion?

Following function calculates factorial of a number using recursion.   unsigned int factorial(unsigned int a) { if (a == 1) return 1; else { a *= factorial(a-1) (MORE)