Computer Science, asked by virkyadh5722, 10 months ago

write a program to calculate factorial using function over loading​

Answers

Answered by benhurmuthu
1

Explanation:

#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;

}

Answered by yash12345studentsliv
0

Explanation:

Function overloading is a feature in C++ where two or more functions can have the same name but different parameters. Function overloading can be considered as an example of polymorphism feature in C++. Following is a simple C++ example to demonstrate function overloading.

mark as brainlist

Similar questions