A recursive function to calculate the factorial of a given positive number:

void main()

{

int n,c;

clrscr();

printf("enter the number :");

scanf("%d",&n);

c=fact(n);

printf("factorial of %d = %d",n,c);

getch();

}

fact(int n)

{

int factorial;

if(n==1||n==0)

return(1);

else

factorial=n*fact(n-1);

return (factorial);

}