Imports System.IO
Module Module1
Sub Main()
Dim n As Integer = 5, fact As Integer = 1, i As Integer = 1
Try
For i = 1 To n
fact *= i
Next
Console.WriteLine(fact)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub
' run:
'
' 120
End Module