Module Module1
Sub Main()
Dim n, i, f As Integer
Console.WriteLine("Enter the value for n")
n = CInt(Console.ReadLine())
f = 1
If n < 0 Then
Console.Write("fact of -ve num is not possible")
elseif n=0 OR n=1 then
Console.WriteLine("fact of" + n.ToString + "is" + f.ToString)
Else
For i = 1 To n
f = f * i
Next
Console.WriteLine("fact of" + n.ToString + "is" + f.ToString)
End If
Console.ReadKey()
End Sub
End Module
Sub Main()
Dim n, i, f As Integer
Console.WriteLine("Enter the value for n")
n = CInt(Console.ReadLine())
f = 1
If n < 0 Then
Console.Write("fact of -ve num is not possible")
elseif n=0 OR n=1 then
Console.WriteLine("fact of" + n.ToString + "is" + f.ToString)
Else
For i = 1 To n
f = f * i
Next
Console.WriteLine("fact of" + n.ToString + "is" + f.ToString)
End If
Console.ReadKey()
End Sub
End Module
No comments:
Post a Comment