Factorial:
-factorial of number is the multiplication of every integer number between 1 and that number.
Example-
factorial of 3 is 6(1*2*3)
factorial of 5 is 120(1*2*3*4*5)
program:
#include < iostream>
using namespace std;
int main()
{
int n,ans=1,i;
cout<<"Enter any numbern";
cin>>n;
for(i=n;i>0;i--)
ans=ans*i;
cout<<"Factorial is: "<< ans;
return 0;
}
Enter any number
5
Factorial is: 120
Enter any number
4
Factorial is: 24
Enter any number
6
Factorial is: 720