Answer to Question #273501 in C++ for Hope

Question #273501

LOOPING STATEMENTS AND FUNCTIONS


Create a flowchart to guide you in the process

Create a function that will accept the value of i and return the value of 

Possible values of i is any positive value from 2 to 10

is computed based on the value of i; see the following table for the sample Input / Output

!!Please see these 3 examples on how the screen will work when the program runs!!

1.)

i : 3

Process: 1*2*3

n: 6


2.)

i: 5

Process: 1*2*3*4*5

n: 120


3.)

i: 7

Process: 1*2*3*4*5*6*7

n: 5040


Screen/Layout

(Home Screen)

Input i:3

Process: 1*2*3

Output: 6


Try Another [Y/N]: Y



Input i: 5

Process: 1*2*3*4*5

Output: 120


Try Another [Y/N]: Y


1
Expert's answer
2021-12-01T00:52:54-0500
#include<iostream>
using namespace std;
int main(){
	int i;
	cin>>i;
	cout<<"Process = ";
	int fact = 1;
	int n = 1;
	for(int x=i; x>=1; x--){
		
		
		fact *= x;
	
				cout<<n <<"*";
				n++;
			
	}
	
	cout<<"\nn: "<<fact<<endl;
}

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 the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS