Logic for finding Factorial
Let n=5 be the number then,
Factorial = 5 x 4 x 3 x 2 x 1 = 120
So, let’s do same logic in coding
Flowchart
Code
/*find factorial of integer*/
#include<conio.h>
#include<stdio.h>
void main()
{
int n, i, f;
printf(“Enter any number: ”);
scanf(“%d”, &n);
f=1;
for (i = 1; i<=n; i++)
{
f = f * i;
}
printf(“Factorial Value = %d”, f);
getch();
}
The post Calculate Factorial of the integer – C program – Code appeared first on The Computer Students.