In mathematics, the factorial of a positive integer n, denoted by n!, is the product of all positive integers less than or equal to n.
For example, 5 ! = 5 * 4* 3 * 2* 1 = 120
Using While Loop
type 1:
//Program for Factorial
#include<stdio.h>
#include<conio.h>
void main()
{
int n,fact=1;
clrscr();
printf(“Enter any Number:\n\n”);
scanf(“%d”,&n);
while(n>1)
{
fact=fact*n;
n–;
}
printf(“\nFactorial is=%d”,fact);
getch();
}