Factorial program in VB.NET

Factorial Program in VB.NET:
Factorial, in mathematics, the product of all positive integers less than or equal to a given positive integer and denoted by that integer and an exclamation point. Thus, factorial seven is written 7!, meaning 1 × 2 × 3 × 4 × 5 × 6 × 7.
Factorial of n is the product of all positive descending integers. Factorial of n is denoted by n!. For example:


The factorial is generally used in Combinations and Permutations (mathematics).
Let’s see the Factorial program in VB.NET using for loop.

Imports System
Module Program
Sub Main(args As String())
Dim i, number As Integer, fact As Integer = 1
Console.Write(“Enter any Number: “)
number = Integer.Parse(Console.ReadLine())

For i = 1 To number
fact = fact * i

Console.Write(“Factorial of ” & number & ” is: ” & fact)
End Sub
End Module



Leave a Reply

Your email address will not be published.