Write a C language program to calculate the factorial of an integer number.
#include<stdio.h>
#include<conio.h>
void main()
{
int num, i, fact=1;
printf("Enter a number : ");
scanf("%d",&num);
for(i=num; i>0; i--)
{
fact=fact*i;
}
printf("Factorial of %d is: %d",num,fact);
getch();
}
Input/Output:
Enter a number: 5
FActorial of 5 is: 120
No comments
Dear Members, Thanks for Your Comments. We must be reply your comment answer as soon as possible. Please Stay with us.....