This is C Program Find the Factorial of N Number. This program is for finding the factorial of N number. Two integer type variables declared with static value one of them. Here to user enter the value for finding the factorial. Then loop statement for stepping forward to find the result and (f*I) and at last to print the output on the display.
Problem Statement:
This is C Program that has to find the factorial of N numbers.
- Enter the numbers.
- Using loop statement.
- Display result on the screen.
Here is source code of the C program that has to find the factorial of N numbers. The C program is successfully compiled. The program output is also shown below.
#include<stdio.h>
main()
{
int num,i,f=1;
clrscr();
printf("Enter the a Num : ");
scanf("%d",&num);
for(i=num;i>=1;i--)
{
f=f*i;
}
printf("%d",f);
getch();
}
Output :
Enter the a Num : 5
120