#include<stdio.h>
int fac(int n);
int main( )
{
int n, fact;
printf("Enter a number");
scanf("%d",&n);
fact=fac(n);
printf("Factorial of number %d is %d", n, fact);
return 0;
}
int fac(int n)
{
if(n==0 || n==1)
return 1;
else
return(n*fac(n-1));
}
int fac(int n);
int main( )
{
int n, fact;
printf("Enter a number");
scanf("%d",&n);
fact=fac(n);
printf("Factorial of number %d is %d", n, fact);
return 0;
}
int fac(int n)
{
if(n==0 || n==1)
return 1;
else
return(n*fac(n-1));
}
0 Comments