# Calculate Factorial of a number in LabView : tutorial 35

In this tutorial I will help you to design a VI that will take a number as input from the user and at the output it will return the factorial of that natural number. For example, the user enters 3 as an input value to the VI then the output of the VI will return 1*2*3 = 6 in the indicator. We will be using a ‘for’ loop to do so. At the end of the tutorial you are provided with an exercise to do it by yourself.

### Calculate Factorial of a number in LabView

Figure 1: Input control

Figure 2: For loop placement

Figure 3: Number of loops

Figure 5: Numeric constant placement

Figure 6: Shift register constant

Figure 7: Placement of multiply block

Figure 8: Increment block placement

Figure 9: Factorial calculation block diagram

Figure 10: Output indicator placement

Figure 11: Complete block diagram

Figure 12: Output 1

Figure 13: Output 2

Exercise:

• Design a VI that will take two input integers and calculate the Product of natural numbers between those two integers

<< Previous tutorial                                                  Next tutorial>>