cstartes
Search stops here
Pages
Home
Blogroll
Guest Post
Privacy Policy
Contact Us
About
Program using a recursive function to find factorial of no.
float fact(int);
void main()
{
int n;
float f;
printf("Enter the no");
scanf("%d",&n);
f=fact(n);
printf("Factorial=%f",f);
getch();
}
float fact(int x)
{
float f1;
if(x==1_
{
return;
}
else
{
f1=x*fact(x--);
}
return(f1);
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment