1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
iris [78.8K]
4 years ago
7

#include using namespace std; void PrintFactorial(int factCounter, int factValue){ int nextCounter; int nextValue; if (factCount

er == 0) { // Base case: 0! = 1 cout << "1" << endl; } else if (factCounter == 1) { // Base case: Print 1 and result cout << factCounter << " = " << factValue << endl; } else { // Recursive case cout << factCounter << " * "; nextCounter = factCounter - 1; nextValue = nextCounter * factValue; /* Your solution goes here */ } } int main() { int userVal; cin >> userVal; cout << userVal << "! = "; PrintFactorial(userVal, userVal); return 0; }

Engineering
1 answer:
bazaltina [42]4 years ago
8 0

Answer:

Check the explanation

Explanation:

Code in C++::

#include <iostream>

using namespace std;

void PrintFactorial(int factCounter, int factValue){

int nextCounter = 0;

int nextValue = 0;

if (factCounter == 0) { // Base case: 0! = 1

cout << "1" << endl;

}

else if (factCounter == 1) { // Base case: Print 1 and result

cout << factCounter << " = " << factValue << endl;

}

else { // Recursive case

cout << factCounter << " * ";

nextCounter = factCounter - 1;

nextValue = nextCounter * factValue;

/* Your solution goes here */

/**

* We just need to call the function PrintFactorial() recursively

* and pass the two parameters that are just calculated as nextCounter for factCounter

* and nextValue as factValue.

*/

PrintFactorial(nextCounter,nextValue);

}

}

int main() {

int userVal = 0;

userVal = 5;

cout << userVal << "! = ";

PrintFactorial(userVal, userVal);

return 0;

}

Output::

Test Case 1 where userVal=5::

<em><u>Attached Image 1</u></em>

Test Case 2 where userVal=6::

<em><u>Attached Image 1</u></em>

You might be interested in
A force of 16,000 will cause a 1 1 bar of magnesium to stretch from 10 to 10.036 . Calculate the modulus of elasticity in . (Ent
Bad White [126]

The modulus of elasticity is 44.4GPa

E<u>xplanation:</u>

Given

original length L1=10cm

New length L2=10.036 cm

Force F=16000N

dimensions\ of\ the\ bar\ is\ 1 cm\times1cm\\Area=1cm\times1cm=1cm^2=0.0001m^2

Stress of the bar σ=Force/Area

=16000/0.0001=16\times 10^7N/m^2

Change in length ΔL=L2-L1=10.036-10=0.036 cm

Strain is obtained by dividing the change in length by original length

Strain ε=ΔL/L1

=0.036/10=0.0036

Modulus of elasticity=stress/strain

=σ/ε

=16\times10^7/0.0036\\=4.44\times10^\ 10Pa

=44.4GPa

5 0
3 years ago
Which term describes erosion?
Vera_Pavlovna [14]

Answer:

transports solid materials

7 0
3 years ago
Read 2 more answers
The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the probl
Yanka [14]

Question Continuation

public class DebugOne3{

public static void main(String args){

System.out.print1n("Over the river");

System.out.pr1ntln("and through the woods");

system.out.println("to Grandmother's house we go");

}

}

Answer:

Line 2: Invalid Syntax for the main method. The main method takes the form

public static void main (String [] args) { }

or

public static void main (String args []) { }

Line 3: The syntax to print is wrong.

To print on a new line, make use of System.out.println(".."); not System.out.print1n();

Line 4:

To print on a new line, make use of System.out.println(".."); not System.out.pr1ntln();

Line 5:

The case of "system" is wrong.

The correct case is sentence case, "System.out.println" without the quotes

The correct program goes, this:

public class DebugOne3{

public static void main(String [] args){

System.out.println("Over the river");

System.out.println("and through the woods");

System.out.println("to Grandmother's house we go");

}

}

Explanation:

3 0
3 years ago
What are the four basic parts of process plan
Rus_ich [418]

Answer:

1. Goal setting

2. Developing the planning premises

3. Reviewing Limitations

4. Deciding the planning period

5. Formulation of policies and strategies

6. Preparing operating plans

7. Integration of plans

Explanation:

I don't have an explanation but i thru in a few extra answers for like extra credit or something if your teacher does that

8 0
3 years ago
1. What is resilience engineering and how does it pertain to the current<br>corona virus crisis? ​
saw5 [17]

Answer:

the ability to absorb or avoid damage without suffering complete failure and is an objective of design, maintenance and restoration for buildings and infrastructure

Explanation:

8 0
3 years ago
Other questions:
  • Steam enters a turbine operating at steady state at 600°F and 200 lbf/in^2 with a velocity of 80 ft/s and leaves as saturated va
    12·1 answer
  • The Molybdenum with an atomic radius 0.1363 nm and atomic weight 95.95 has a BCC unit cell structure. Calculate its theoretical
    15·1 answer
  • A Type I muscle fibers have an average diameter of 98 µm, and can exert a compressive load of 532 µN[1]. If they are modeled as
    11·1 answer
  • Your class has designed a self-cleaning reptile tank. What kind of patent would you apply for? A. a plant patent B. a design pat
    14·2 answers
  • Which type of design does not need special care for the placement of dimensions?
    5·1 answer
  • Select the correct verb form to complete each of the following sentences.Members of the committee ____ issued a mobile phone and
    8·1 answer
  • Consider unsteady fully developed Coutte flow between two infinite parallel plates. This problem involves the following paramete
    5·1 answer
  • The housing for a certain machinery product is made of two components, both aluminum castings. The larger component has the shap
    10·1 answer
  • (1+4i)−(−16+9i)<br> i will give brailiest<br> no reporting
    10·2 answers
  • Consider a cup on a dinning table half filled with water.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!