/* Example Program For Factorial Value Using For Loop In C++
*/#include<iostream.h>
#include<conio.h>
void main()
{
// Variable Declaration
int counter, n, fact = 1;
// Get Input Value
cout<<"Enter the Number :";
cin>>n;
//for Loop Block
for (int counter = 1; counter <= n; counter++)
{
fact = fact * counter;
}
cout<<n<<" Factorial Value Is "<<fact;
// Wait For Output Screen
getch();
}
Sample Output
Enter the Number :6
6 Factorial Value Is 720
Tags:
C++ Program to find Factorial of a number using For Loop In C++.
c++ programming
manjeet singh kuthar
mskuthar