//this is a program to find the factorial of the entered number using user defined function
#include<stdio.h>
#include<conio.h>
long int fact();
void main()
{
long int factorial;
factorial=fact();
printf("\n\nFactorial is %ld",factorial);
getch();
}
long int fact()
{
int num,i;
long int facto=1;
printf("\n\nEnter The Number: ");
scanf("%d",&num);
for(i=1;i<=num;i++)
{
facto=facto*i;
}
return facto;
}
#include<stdio.h>
#include<conio.h>
long int fact();
void main()
{
long int factorial;
factorial=fact();
printf("\n\nFactorial is %ld",factorial);
getch();
}
long int fact()
{
int num,i;
long int facto=1;
printf("\n\nEnter The Number: ");
scanf("%d",&num);
for(i=1;i<=num;i++)
{
facto=facto*i;
}
return facto;
}