Pages
HOME
DEVELOPERS
PROJECTS
PROGRAMS
TUTORIAL
DATA STRUCTURE & ALGORITHM
HELP
Program to find FACTORIAL using "RECURSION"
#include<iostream.h>
#include<conio.h>
int fact(int n)
{
int f=1;
if(n==1)
{
return f;
}
else
{
f=n*fact(n-1);
return f;
}
}
void main()
{
clrscr();
int n;
cout<<"enter a no.";
cin>>n;
cout<<"\n\n";
cout<<"factorial is"<<fact(n);
getch();
}
Newer Post
Older Post
Home