What is recursion explain with example?

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);
}
+ 20 others found this useful
Thanks for the feedback!
QUIZ-A-THON

Become Politically Savvy, Win iPad Air!

Answers CEO David Karandish talks about the importance of the upcoming midterm elections.

Every day from October 15th until the election you can take a quiz to learn about the issues and be entered to win an iPad!

Follow

How does Neon Future I compare to your debut album Wonderland?

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 Uncategorized

What is query explain with the help of an example?

Literally "query" is just another word for "question". So right up there is an example. In SQL, a query would be something likeSELECT NAMEFROM EMPWHERE DEPARTMENT = 'MARKETING (MORE)

What is inheritance explain with an example?

Inheritance is a feature in Java wherein one class will inherit or use the features of another class.Ex: public class A extends B {…}Here class A is the child class and B th (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 subme (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 a def (MORE)
In Grammar

How do you explain the examples personal pronoun?

A personal pronoun is a pronoun designating the person speaking (first person), the person spoken to (second person), or the person or thing spoken about (third person); a pro (MORE)