Recursive Function Demo : Function Recursive « Language Basics « VB.Net






Recursive Function Demo

Recursive Function Demo
Imports System
Imports System.Diagnostics


Public Class MainClass
    Shared Sub Main()

        Dim N As Long = 10
        Dim result As Long = Fibo(N)
        Console.WriteLine(result)

    End Sub
    Private Shared Function Fibo(ByVal n As Long) As Long
        If n <= 2 Then Return n
        Return Fibo(n - 1) + Fibo(n - 2)
    End Function

End Class

           
       








Related examples in the same category

1.Function RecursiveFunction Recursive
2.Display directories on your drive recursivelyDisplay directories on your drive recursively
3.Calculating factorials using recursionCalculating factorials using recursion