#include<iostream> #include<conio.h> using namespace std; //Function long factorial(int); int main() { // Variable Declaration int counter, n; // Get Input Value cout<<“Enter the Number :”; cin>>n; // Factorial Function Call cout<<n<<” Factorial Value Is “<<factorial(n); // Wait For Output Screen getch(); return 0; } // Factorial recursion Functionlong factorial(int n) { if (n == 0) return 1; else return(n * factorial(n-1)); }
Output :
Enter the Number :6
6 Factorial Value Is 720