Module PerNum_inBetween Sub main() Dim min, max, p, sum, r AModule Factorial Sub Main() Dim n, fact, t As Integer Console.Write("Enter a Number:") n = CInt(Console.ReadLine()) Console.WriteLine("Given Number= " + n.ToString()) t = n fact = 1 If t < 0 Then Console.WriteLine("No factorial for negative number") ElseIf t = 0 Or t = 1 Then Console.WriteLine("Factorial of " + t.ToString() + "is 1") Else While t > 0 fact *= t t -= 1 End While Console.WriteLine("Factorial of " + n.ToString() + "=" + fact.ToString()) End If Console.ReadLine() End Sub End Module
Visual Basic dot net VB.net programming microsoft .net framework object oriented language network enabled technology visual basic 2005 IDE integrated development environment console application microsoft cre common runtime environment
Find Factorial using While loop
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment