#include <stdio.h>int fact(int n )
{
if(n >= 1)
return n * fact(n - 1);
else
return 1 ;
}
int main()
{
int num;
printf("Enter an integer : ");
scanf("%d" , &num);
printf("Factorial of %d is : %d\n" , num , fact(num));
return 0 ;
}
No comments:
Post a Comment