Find factorial of a number in C++

This is a simple program to find the factorial of a number. Factorial of a number is the product of numbers from 1 to that number. For instance, factorial of 4 is 4 * 3 * 2 * 1 = 24.

In this program we asks the user for an input. Before processing we check whether the number is less than 1, because a number less than 1 doesn’t have a factorial. Next we reduce the number until it becomes 1 and multiply the factorial with each number. Here is the program:

Leave a Reply

Your email address will not be published. Required fields are marked *