write a program to calculate factorial using function over loading
Answers
Answered by
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
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
English,
6 months ago
Math,
6 months ago
English,
6 months ago
Psychology,
1 year ago
CBSE BOARD XII,
1 year ago
Science,
1 year ago
English,
1 year ago