60 665
Assignments Done
97,7%
Successfully Done
In April 2018

Answer to Question #56579 in C++ for miky

Question #56579
Take an integer from the user and display the factorial of that number
Expert's answer
#include <iostream>

using namespace std;

int main()
{
int value, factorial = 1;
cout << "Input integer = ";
cin >> value;
if (value < 0)
cout << "Invalid input";
else
{
for (int i = 1; i <= value; i++)
{
factorial *= i;
}
cout << "Factorial = " << factorial << "\n";
}
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