// A C program to find factorial of a number using recursion.
#include<stdio.h>#include<conio.h>
int factorial(int);
void main(){
clrscr(); int num,fact=0;
printf("Enter an integer number: "); scanf("%d",&num);
fact=factorial(num);
printf("Factorial of %d is = %ld",num,fact);getch();
}
int factorial(int num)
{
if(num<=1)
return 1;
else
return(num*factorial(n-1));
}
Output:
0 Comments