Program to find factorial of Number in C++ | Interesting321

factorial of Number in C++:

if a number is given for example 3, the factorial of number 3 is 3*2*1 which means 6.

 The logic of the program:

         The logic of the program is very easy. the given value is assigned in a variable name

n. For loop end with 1, not a 0, it increases the element till the ‘n’ number and both the

elements are multiply 1*2*3 = 6.

#include< iostream.h >
using namespace std;
int main()
int n,fact=1;
cout<<"Enter the positive numbers";
for(int i=1;i<=n;i++)
cout <<"factorial of the number is %d" << fact ;


For download CPP file click below download button:

Recommended Posts:

Leave a Comment