# How to find factorial of a given number using C++ program | techgsr

Welcome to our blog post In this program, we will learn program how to find factorial of a given number using C++ program? Here, we will implement this program with and without using user define function.

### Logical Part of program:

1. Input a number
2. Initialize the factorial variable with 1
3. Initialize the loop counter with N (Run loop from number (N) to 1)
4. Multiply the loop counter’s value with factorial variable

#include <iostream>

using namespace std;

int main()

{

int num,i;

long int fact=1;

cout<<“Enter an integer number: “;

cin>>num;

for(i=num;i>=1;i–)

fact=fact*i;

cout<<“Factorial of “<<num<<” is = “<<fact<<endl;

return 0;

}

Output :-

Enter an integer number: 6

Factorial of 6 is = 720

## Related Post:-

Predict the output of following C++ program in cpp

Print 1 to 100 in C++, without loop and recursion

Factorial Using Loop Example Program In C++

bfs algorithm in data structure (BFS)

if..else Statement Example Program In C++

For Loop Example Program In C++

Program to find the sum of each row & column of a matrix of size n x m andif matrix is square, find the sum of the diagonals also.

how to create age calculator in html project

how to make toast in html css and javascript

how to make copy to clipboard in javascript

how to create email validation in javascript

So I hope that you learn about the How to find factorial of a given number using C++ program.And if you have any more queries about computer relegated then feel free to discuss your problem in the comment section.
Thank you so much and come back for more updates about Techgsr.co