Program for Finding Factorial of a given number using Recursion

#include<stdio.h>
#include<conio.h>
fact ( int n);
main( )
{
int n, r;
printf (“enter a value “);
scanf (“/d”,&n);
r=fact(n);
printf (“factorial is % d “,r);
}
fact ( int n)
{
If (n==1)
return 1;
else
return ( n*fact (n–1));
}

Out Put:

Enter n value 5                                

Factorial is 120                                 

Related

C Programs 2625421769194474389

Post a Comment

emo-but-icon

item