C++ Program To Find Factorial

This program is used to find factorial of n numbers.


2.Get the input from user for variable n (ie) an integer number
3.Initialize fact as 1
4.You will need a for loop to find factorial of given number
5.In for loop set i as 1 then compare if i is lesser than or equal to zero
6.If step-5 is true declare fact as fact * i and if step-5 is false stop the program
7.Increment i value by 1


# include <iostream.h>
# include <conio.h>
void main ()
          int n, fact = 1;
          cout << "Enter Value For N:";
          cin >> n;
          for (int i = 1; i <= n; i + +)
                    fact = fact * i;
           cout << "The Factorial Of" << n << "Is:" << fact;
           getch ();

Manish Jain

Manish Jain is an indian blogger who loves to learn and find out interesting tweaks and tricks on pc and smartphones and share them with world .