67 095
Assignments Done
99,3%
Successfully Done
In November 2018

Answer to Question #3310 in C++ for mukunda

Question #3310
Write a program to calculate the factorial of given number.
Expert's answer
#include <iostream>
using namespace std;

double calculate_factorial (double number)
{
if (number == 0) return 1.0;
return number * calculate_factorial(number-1);
}

int main()
{
double number = 8;
double factorial = calculate_factorial (number);
cout << "The factorial is " << factorial << endl;

return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions