Write a program in C++ to find the factorial using Loop
The factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n.
For example,
6! = 6 x 5 x 4 x 3 x 2 x 1 = 720
#include<iostream> #include<conio.h> using namespace std; int 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(); return 0; }