# Answer to Question #47568 in C++ for krad

Question #47568

Write a program to calculate the factorial value of the input number n! use the incrementation formula (i++) for your solution instead of decrementation formula (1--).

Sample input/output dialogue:

Enter a Number: 4

Factorial value: 24

(The computation is: 1*2*3*4=24)

Sample input/output dialogue:

Enter a Number: 4

Factorial value: 24

(The computation is: 1*2*3*4=24)

Expert's answer

#include <iostream>

using namespace std;

//main method

int main()

{

int Number;//variable for input number

int Factorial=1;//variable for result

//promt user to enter Number

cout<<"Enter a Number: ";

//read number

cin>>Number;

for(int i=1;i<=Number;i++){

Factorial*=i;

}

//show result

cout<<"Factorial value: "<<Factorial<<"\n";

//delay

system("pause");

//exit program

return 0;

}

using namespace std;

//main method

int main()

{

int Number;//variable for input number

int Factorial=1;//variable for result

//promt user to enter Number

cout<<"Enter a Number: ";

//read number

cin>>Number;

for(int i=1;i<=Number;i++){

Factorial*=i;

}

//show result

cout<<"Factorial value: "<<Factorial<<"\n";

//delay

system("pause");

//exit program

return 0;

}

``

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment