## C++ Program to Find Factorial

In this program,we learn to calculate the factorial of num using for loop in this program.

You must have basic knowledge of C++ programming language and variable , while loop and if..ealse and for loop

We every number is equal to 1*2*3*4*5*..n.You must have basic knowledege of programming language before start program.To understand this program ,you must have the knowledge of c++ programming topics such as for loop and basic syntax.

You must have basic knowledge of C++ programming language and variable , while loop and if..ealse and for loop

## Write a program to find the factorial of any number.

We every number is equal to 1*2*3*4*5*..n.You must have basic knowledege of programming language before start program.To understand this program ,you must have the knowledge of c++ programming topics such as for loop and basic syntax.

### For any number ,This is factorial number is given by

[factorial = 1*2*3*4*5*6*..........*n]

## Example 1: Find Factorial of a given number by user

In this factorial program given value through the user.

#include<iostream>

#include<conio.h>

using namespace std;

int main()

{

int n=;

int fact;

cout << "Plz enter the any postive number";

cin>>n;

for(i=1;i<=n;i++)

{

fact=fact*i;

}

cout << n<<"Factorial number is="<<fact;

return 0

getch();

}

output

----------------------------------------------

Plz enter the any postive number

5

The greatest number is:120

## Example 2: Find Factorial of a given number

#include<iostream>

#include<conio.h>

using namespace std;

int main()

{

int n=4;

int fact;

for(i=1;i<=n;i++)

{

fact=fact*i;

}

cout << n<<"Factorial number is="<<fact;

return 0

getch();

}

Result

----------------------------------------------

The greatest number is:120

You should have basic programming knowledege

like syntax and variable and if else statement or for loop that is must learn before starting

the program.