Ans.
#include<stdio.h>
#include<conio.h>
void main()
{
int fact=1,num;
clrscr();
printf("\nEnter Number : ");
scanf("%d",&num);
while(num>=1)
{
fact=fact*num;
num--;
}
printf("\nFactorial value of %d is %d",num,fact);
}
Output of above program :
Enter Number : 5
Factorial value of 5 is 120
No comments:
Post a Comment