Write a VB(visual basic 6.0) program to find factorial number

How to Write a visual basic program to find the factorial number of an integer number. Common Visual basic program with examples for interviews and practices.

We can find the factorial of any number which is greater than or equal to 0(Zero). Below is the Program to write a factorial program in Visual basic. Check the simple programs in visual basic.

What is Factorial Number

Factorial Number is a mathematical operation on a number. The factorial symbolized by an exclamation mark ! Example 5!. We can fina the factorial any positive number or number which is greater or equal to Zero.

Mathematical Formula to find factorial number

If n is an integer number then and n is greater than or equal to Zero then factorial of n is

n ! = n ( n – 1)( n – 2)( n – 3) … (3)(2)(1)

Note: Factorial of zero always will be 1.

Example: Let’s understand it by an example. Here we will find the factorial of 6.

6! = 6*5*4*3*2*1

6!= 720 Ans.

Now hope you understand what is a factorial number and how can we find the factorial of a number using a mathematical formula. Now let’s see how can we covert the same problem in the visual basic program.

How to Find factorial number in visual basic

Private Sub Command1_Click()

Dim j, i as Integer

i = CInt(Text1.Text)

Label2.Caption = facts(i)

End Sub

Private Function facts(i)

F = 1

For j = 1 To i

F = F * j

facts = F

Next j


End Function

Visual Basic programs with example

Java Program for Interview with example

Past Year’s Placement papers for Interview of MNC

Leave a Reply

Your email address will not be published.

5 + 16 =