Module Module1 '関数 Function fact(n As Integer) Dim result As Integer If   @   Then result =   A   Else result =   B   End If fact = result End Function 'メイン Sub Main() Dim n As Integer Dim ans As Integer Dim work As String Console.Write("nを入力:") work = Console.ReadLine() '文字で入力されるので n = Integer.Parse(work) '整数に変換する ans = fact(n) Console.WriteLine(n & "の階乗は" & ans) Console.WriteLine("何かキーを押してください") Console.ReadKey() End Sub End Module