In this post, we will write a **C++ program to calculate the factorial of a given number**. user will enter a number and the program will print the factorial of that number.

## C++ program to calculate factorial of a given number.

```
#include<iostream>
#include<conio.h>
int main()
{
system("cls");
int i,n;
double res;
std::cout<<"Enter any number = ";
std::cin>>n;
res = 1;
for(i=1;i<=n;i++)
res = res*i;
std::cout<<"The factorial of given number is = "<<res;
getch();
return 0;
}
```

### Output

Enter any number = 6 The factorial of given number is = 720