+ 1

Can anyone explain me recursive function?

I am newbie, learning java programming.

24th Dec 2019, 4:20 AM
pallavi patil
4 ответов
+ 1
Recursion is used when you have a big problem and the solution to it is a smaller problem and this goes on. For eg take the factorial problem, to find 5's factorial you need a 4's factorial and to find a 4's factorial you need a 3's factorial and so on until you get your final result.
24th Dec 2019, 4:25 AM
Avinesh
Avinesh - avatar
24th Dec 2019, 10:27 AM
id001x
id001x - avatar
0
Recursive function is a function which calls itself repeatedly certain number of times. For ex: print n to 1 numbers. void print(int n) { if(n>0) { System.out.println(n); print(--n); //recursively calling from n to 0; } If n=10, then it prints 10 to 1 numbers By calling print(10),print(9),print(8)....print(0).
24th Dec 2019, 12:36 PM
Jayakrishna 🇮🇳
0
recursive consists of calling the function inside of itself
26th Dec 2019, 8:41 PM
Moustapha Dieye
Moustapha Dieye  - avatar