Home > DeveloperSection > Forums > How to understand the recursive call to itself
Kenny Tangnde

Total Post:68

Points:476
Posted on    November-03-2011 2:37 AM

 C# C# 
Ratings:


 2 Reply(s)
 1338  View(s)
Rate this:

Hi all,

   such as:

Public Function Factorial(As IntegerAs Integer
    If N <= Then
        Factorial = 1
    Else
        Factorial = Factorial(N - 1* N
    End If
End Function
Sub res()
   Debug.Print Factorial(4)
End Sub

Its principle is to perform what,why the output is 24.

thanks!



Alex R
Alex R

Total Post:40

Points:280
Posted on    November-03-2011 5:49 AM

Hi Aken,

This is not a class room where you will get the code explained.

Here, you can discuss your problem you are getting in your project or if you are stuck somewhere in your code. By this way experts here stop looking at your problem and you won't get your problem solved.

So, please ask only relavent questions.

By the way, the above code is calculating the factorial of 4.

i.e. 4*3*2*1

Google for detailed information about Recursion.

Hope you will understand and won't repeat your mistakes again.

Thanks


Kenny Tangnde

Total Post:68

Points:476
Posted on    November-03-2011 9:04 AM

Hi Haider,

     sorry,i know,thanks for your help.


Don't want to miss updates? Please click the below button!

Follow MindStick