Factorial:
-factorial of number is the multiplication of every integer number between 1 and that number.
Example-factorial of 3 is 6(1*2*3)
factorial of 5 is 120(1*2*3*4*5)
Function:-A part of program which is uniquely identify and have different area.
-Here we make a function that are able to return the factorial of the given number.
program-#include < stdio.h>
int Factorial(int n)
{
printf("Enter Number\n");
scanf("%d",&n);
ans=Factorial(n);
printf("Factorial is %d",ans);
}
output-
Enter Number
5
Factorial is 120
-In this program, we make a function named as 'Factorial(int n)', here 'n' is the argument which pass in the function for finding the factorial.
-We run the loop start from 1 to input number i.e. for(i=1;i< n=;i++)
-Multiply each value of i in loop ans store in 'fac' variable and at last it would return by the function.