Program to find factorial of given number in c language.
Factorial ->
Factorial of n is the product of all positive descending integers. Factorial of n is denoted by n!
■ For example:
* 5! = 5*4*3*2*1 = 120
* 3! = 3*2*1 = 6
■Program for find the factorial of a number -
#include<stdio.h>
#include<conio.h>
void main()
{
int n,fact=1;
int i;
clrscr();
printf("Enter a number=");
scanf("%d",&n);
for(i=1; i<=n; i++)
{
fact=fact*i;
}
printf("the factorial of no. is=%d",fact);
getch();
}
Output-
Comments
Post a Comment