Write a program to print the factorial of a given number using recursion.
#include<stdio.h>
#include<conio.h>
int fact(int);
void main()
{
int m,result;
clrscr();
printf(“enter the number”);
scanf(“%d”,&m);
result=fact(m);
printf(“%d”,result);
getch();
}
int fact(int m)
{
int x=1;
if(m==1);
return(1);
else
x=m*fact(m-1);
return(x);
}
0 Comments
Have any query? Want any type of module?
Please comment it down and let me know.