#include <stdio.h>
#include <stdlib.h>
int main()
{
int n;
// n is the number you want the factorial to be calculated.
printf("Enter value of n\n");
scanf("%d",&n);
printf("factorial of given number is %d",fact(n));
}
int fact(int n){
if(n>0){
return (n*fact(n-1));
}
else
return 1;
}
0 comments:
Post a Comment