Write a program to find factorial of given number using recursive function.
Solutions:
#include<stdio.h>
#include<conio.h>
int fact(int);
void main(){
int n,f;
printf("Enter no. for finding factorial :");
scanf("%d",&n);
f=fact(n);
printf("factorial is %d",f);
getch();
}
int fact(int n){
if(n==0){
return(1);
}
else{
return(n*fact(n-1));
}
}
x
0 Comments