#include<stdio.h>

long int fact(int p);
main()
{
    long int k;
    int n;
    printf("enter n");
    scanf("%d",&n);
    k=fact(n);
    printf("the factorial of %d is=%ld",n,k);
}
long int fact(int p)
{
    long int f=1;
    int i;
    for(i=1; i<=p; i++)
    {
        f=f*i;
    }
    return f;
}
     
           
Note: Need to be arranged in compiler after copied
   

 OutPut:

enter n5 the factorial of 5 is=120