Unknown Unknown Author
Title: C++ Programming How to find Factorial using Functions
Author: Unknown
Rating 5 of 5 Des:
C++ Programming How to find Factorial using Functions This Program will show how to find a factorial of any number using Function Program # ...

C++ Programming How to find Factorial using Functions

This Program will show how to find a factorial of any number using Function


Program # 5 : Factorial using Function :




#include <iostream>

using namespace std;

int factFinder(int x){
   if(x==0){
    return 1;
   }else{
     return x*factFinder(x-1);
   }

}


int main()
{
  cout << factFinder(5) << endl;
}


Note : You can use any integer number in the  code. I just use 5 .


Output of the Program :



Advertisement

Post a Comment

Please Don't Spam You are allowed to comment your website link

 
Top