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
Consider a unidirectional continuous fiber-reinforced composite with epoxy as the matrix with 55% by volume fiber.i. Calculate t
ohaa [14]

Answer:

I)E= 40.95 GPa

II)E=5.29 GPa

Explanation:

I)

Given that

E₁ = 2.41 GPa  ,V₁=1-0.55 = 0.45

E₂ = 72.5 GPa   ,V₂=0.55

Longitudinal moduli  given as ;

E= E₁V₁+E₂V₂

E= 2.41 x 0.45 + 72.5 x 0.55 GPa

E= 40.95 GPa

II)

E₁ = 2.41 GPa  ,V₁=1-0.55 = 0.45

E₂ =230 GPa   ,V₂=0.55

Transverse moduli given as:

\dfrac{1}{E}=\dfrac{V_1}{E_1}+\dfrac{V_2}{E_2}

\dfrac{1}{E}=\dfrac{0.45}{2.41}+\dfrac{0.55}{230}

E=5.29 GPa

7 0
3 years ago
Nonshielded cable with a 1.5-inch diameter should have a minimum bending radius of
Flura [38]

Answer:

c is the answer because we have to double the number

6 0
2 years ago
In this unit, you looked at modern vehicle technology and the ad-
SOVA2 [1]

Answer:Taking as a basis of calculation 100 mol of gas leaving the conversion reactor, draw andcompletely label a flowchart of this process. Then calculate the moles of fresh methanol feed,formaldehyde product solution, recycled methanol, and absorber off-gas, the kg of steamgenerated in the waste-heat boiler, and the kg of cooling water fed to the heat exchangerbetween the waste-heat boiler and the absorber. Finally, calculate the heat (kJ) that must beremoved in the distillation column overhead condenser, assuming that methanol enters as asaturated vapor at 1 atm and leaves as a saturated liquid at the same pressure.

1

SEE ANSWER

Explanation:

8 0
3 years ago
If there’s an unidentified puddle under your car, it means ______.
algol13
Someone dropped a gallon of milk and you parked over it
6 0
4 years ago
Explain the difference in the heat transfer modes of conduction and convection.
LiRa [457]

Explanation:

Conduction is the heat transfer through a stationary matter by the physical contact.  

For example, the heat transferred between electric burner of stove and bottom of pan is transferred by the process of conduction.

Convection is heat transfer by macroscopic movement of the fluid. The particles of the fluid carry the current within themselves.  

For example, the water is the pot is warmed overall by heat transferred by the process of convection.

4 0
3 years ago
Other questions:
  • A closely wound, circular coil with radius 2.80 cm has 720 turns. Part APart complete What must the current in the coil be if th
    14·1 answer
  • Carbon dioxide contained in a piston–cylinder device is compressed from 0.3 to 0.1 m3. During the process, the pressure and volu
    9·1 answer
  • If a ball is dropped from a height​ (H) its velocity will increase until it hits the ground​ (assuming that aerodynamic drag due
    5·1 answer
  • Two-pronged plugs are designed for home use
    11·2 answers
  • Assume all surface are smooth Draw the FBD for each body
    15·1 answer
  • The volume of a right circular cone of radius r and height h is V = 1 3 πr 2h (a) (i) Find a formula for the instantaneous rate
    8·1 answer
  • Which of the following sentences uses the active voice
    15·1 answer
  • a circular pile, 19 m long is driven into a homogeneous sand layer. The piles width is 0.5 m. The standard penetration resistanc
    6·1 answer
  • Which type of turbocharger has a wastegate?
    12·1 answer
  • A simple Brayton cycle using air as the working fluid has a pressure ratio of 10.9. The minimum and maximum temperatures in the
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!