# Thread: answer me plezz ?????

1. ## answer me plezz ?????

Recursion : What is Function Recursion

2. A recursive function is a function that calls itself. It uses a base step and a recursive step.

3. ## need further explanation

Can you explain it by giving a simple example of addition or multiplication plezz

4. Consider a factorial of a number. Let's go with this as a definition: n! = n * n-1 * n-2 .... * 1

Now let's talk about 5 factorial, written as "5!".

5! can be written two ways.

1. 5! = 5 * 4 * 3 * 2 * 1
2. 5! = 5 * 4!

The first view is iterative. The second is recursive.

There's your example.

5. A recursive multiplication (very stupid implementation, but it does the required task):
Code:
```int mul_rec(int x, int y)
{
if (x == 0) return 0;
if (x == 1) return y;
return mul_rec(x - 1, y);
}```
The above code will only work for relatively small numbers, as there is a limit to how much stack you can use [Pedant prevention: Yes, a good compiler will probably make the tail-recursion into a loop].

--
Mats

6. ## need further explanation for:

need and explanation about addition and subtraction of numbers entered through an 1 D array

7. Do your own homework

Popular pages Recent additions