Find The Factorial of a Number using C++ Program

Program to find factorial of Number in C++ : ,Hi,Today we make Program About factorial.The factorial of a positive integer n is equal to 1*2*3*…n. You will learn to calculate the factorial of a number using for loop.

What is a Factorial of a number ‘n’?
The factorial of a number ‘n’ is the product of all number from 1 upto the number ‘n’ it is denoted by n!. For example n=5 then factorial of 5 will be 1*2*3*4*5= 120. 5!= 120

C++ Program to Find Factorial

#include <iostream>
using namespace std;
int main()
unsigned int n;
unsigned long long factorial = 1;
cout << "Please Enter the Number: ";
cin >> n;
for(int i = 1; i <=n; ++i)
factorial *= i;
cout << "Factorial of " << n << " = " << factorial;
return 0;

Output of Program

Enter a positive integer: 12
Factorial of 12 = 479001600