WAP to write the Factorial series -
Factorial Number - 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: n!=n·(n-1)·(n-2)·(n-3)·⋯·3·2·1. For example, 5!=5·4·3·2·1=120.
#include<stdio.h>
int main()
{
int a,i,f=1;
printf("Enter the value ");
scanf("%d",&a);
for (i=1;i<=a;i++)
{
f=f*i;
}
printf("The factorial is %d\n",f);
return 0;
}
Output -
Enter the value 5
The factorial is 120
0 Comments