/* In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal ton. For example,
The value of 0! is 1, according to the convention for an empty product.[1] */
Program
#include<stdio.h>
void main()
{
int no,i,ans=1;
printf("Enter the no\n");
scanf("%d",&no);
for(i=1;i<=no;i++)
{
ans=ans*i;
}
printf("Factorial=%d",ans);
}
Output
Enter the no
5
Factorial=120
No comments:
Post a Comment