Saturday, September 20, 2014

Program to find factorial of any no using Recursion

#include<iostream.h>
#include<conio.h>
int fact(int);
void main()
{
clrscr();
int b;
cout<<"\nEnter a number u want to find factorial: ";
cin>>b;
cout<<fact(b);
}
int fact(int a)
{
if(a==1)
return 1;
else
return (a*(fact(a-1)));
}

Share this

0 Comment to "Program to find factorial of any no using Recursion "