Module Module1
Sub main()
'program to print the factorial value of a input number
'declaring the datatypes
Dim num, factorial As Integer
'initializing the value of factorial
factorial = 1
'entry of the number
Console.WriteLine("Enter the number whose factorial value you want to be generated ")
num = Console.ReadLine
'start of the while loop to calculate the factorial value of the input number
While num <> 0
factorial = factorial * num
num = num - 1
End While
'generating the output of the factorial value
Console.WriteLine("The factorial value of the number you entered is " & factorial)
Console.ReadLine() ' this line of code holds the screen so that you can see the output
End Sub
End Module
Comments
Post a Comment