0
Functions..
The built-in or predefined function for finding the factorial of a number is...
1 ответ
+ 2
The factorial of a number is the product of all the Integers (int) from 1 to that number.!
Examp:
#include<iostream>
using namespace std;
int factorial(int n);
int main()
{
int n;
cout << "Enter a positive integer: ";
cin >> n;
cout << "Factorial of " << n << " = " << factorial(n);
return 0;
}
int factorial(int n)
{
if(n > 1)
return n * factorial(n - 1);
else
return 1;
}
----------------------------
Output :
Enter an positive integer: 6
Factorial of 6 = 720