CryptoJones icon

Recursion Example

CryptoJones | PRO | 08/30/16 08:13:32 PM UTC | 0 ⭐ | 515 👁️ | Never ⏰ | []
VB.NET |

380 B

|

None

|

0 👍

/

0 👎

    Function Factorial(n As Integer) As Integer
        Console.WriteLine(n)
        if (n = 1) Then
            return 1
        Else
            Dim result As Integer = n * Factorial(n - 1)
            Console.WriteLine(n)
            Return result
        End If
    End Function
 
    Sub Main()
        Dim f As Integer = factorial(4)
        Console.WriteLine(f)
    End Sub

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎