Factorial Calculation in C++ Using recursive method
In this C++ program, we will be using recursive method to calculate factorial from 0 through 10. A recursive method is a method that calls itself either directly or indirectly through another method. A recursive declaration of the factorial method is n! = n.(n-1)! with that given, the source code below illustrates just how recursive methods works. #include <iostream> double factorial( double number) using namespace std; int main() { for(int counter = 0; counter <= 10; counter++) cout <<counter<<"! = "<<factorial(counter)<<"\n"<<endl; return 0; } double factorial(double number) { if(number <= 1) return 1; else return number * factorial(number - 1); }