In mathematics, 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,
The value of 0! is 1, according to the convention for an empty product.
Example Program
/* Program of Factorial Using Loop in C++ Pardeep Patel @ studywarehouse.com */#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<<" Factorial Value of "<<n<<" is: "<<fact; // Wait For Output Screen getch(); return 0; }
Sample Output
Enter the Number: 6
Factorial Value of 6 is: 720
In a world brimming with digital possibilities, inspiring young minds to express themselves through writing…
In today's fiercely competitive digital landscape, understanding why SEO is essential for business growth and…
Dive into the world of knowledge with "10 Free Online Courses from MIT"! Presented in…
Welcome to "10 ChatGPT Prompts to Create Your CV." Crafting a compelling CV is essential…
Welcome to our exploration of StellarWP, where we embark on a journey to elevate your…
Managing events on your WordPress website can be a juggling act. Juggling event details, promoting…