PROGRAM FOR FACTORIAL using RECURSION.
#include <iostream>
#include <conio.h>
using namespace std;
long Fact(int Num);
int main()
{
int No;
cout << "Enter Any Number: ";
cin >> No;
cout << "\nFactorial Of Given Number is: " << Fact(No) << endl;
getch();
return 0;
}
long Fact(int Num)
{
long Result;
if (Num == 1)
return 1;
Result = Num * Fact(Num - 1);
return Result;
}
0 comments:
Post a Comment