Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module recursion
- Function Fact(n)
- If (n <= 1) Then
- Fact = 1
- Else
- Fact = Fact(n - 1) * n
- End If
- End Function
- Sub Main()
- Console.Write("n= ")
- Dim n As Long = CLng(Val(Console.ReadLine()))
- Console.WriteLine(Fact(n))
- Console.ReadKey()
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment