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]
3 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]3 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
He is going ___ in the hot air ballon​
Vladimir [108]

no artical shoul be used here

5 0
2 years ago
Milk has a density of as much as 64.6 lb/ft3. What is the gage pressure at the bottom of the straw 6.1 inches deep in the milk?
gregori [183]

Answer:

Explanation:

1 inch is 0.0833333feet

6.1 inches is 0.5083 feet

Density = mass/volume

64.6 = mass/0.50833

mass = 64.6 x 0.5083 =32.83618lb

3 0
3 years ago
Horizontal shear forces and, consequently, horizontal shear stresses are caused in a flexural member at those locations where th
jek_recluse [69]

Answer:

False

Explanation:

When the horizontal shear forces act on the surface there is transverse shear stress at a particular point which is equal in magnitude. Pure bending is less common than a non uniform bending because the beam is not in equilibrium.

5 0
3 years ago
Determine the maximum intensity ww of the uniform distributed load that can be applied to the beam without risk of causing the s
AnnyKZ [126]

Answer:

Please see attachment

Explanation:

Please see attachment

3 0
3 years ago
A student checks her car's tyre air pressure at a petrol station and finds it is 31 psi. Re-express this as an absolute pressure
victus00 [196]

Answer:

Absolute Pressure=315.06256 kPa

Explanation:

Gauge pressure= 31 psi

Atmospheric Pressure at Sea level= 1 atm=101.325 kPa

1\ psi=6.89476\ kPa\\\Rightarrow 31\ psi=31\times 6.89476\\\Rightarrow 31\ psi=213.73756\ kPa=Gauge\ Pressure\\Absolute\ Pressure=Gauge\ Pressure+Atmospheric\ Pressure\\\Rightarrow Absolute\ Pressure=213.73756+101.325\\\therefore Absolute\ Pressure=315.06256\ kPa

5 0
3 years ago
Other questions:
  • An undeformed specimen of some alloy has an average grain diameter of 0.050 mm. You are asked to reduce its average grain diamet
    11·1 answer
  • Create an array of 10 size and assign 10 random numbers. Now find the sum of the array using for and while loop.
    6·1 answer
  • All welding processes that take place without melting of the work pieces. a)- True b)-False
    15·1 answer
  • If Ori gives a friend three reasons for preferring soccer to basketball, that is an algorithm.
    14·2 answers
  • Define;<br>i) Voltage<br>ii) Current<br>iii) Electrical Power<br>iv) Electrical Energy​
    10·1 answer
  • 3. Sitúese en la época de los faraones en Egipto. Usted es el encargado de construir una de esas fabulosas pirámides que fueron
    11·1 answer
  • A tiger cub has a pattern of stripes on it for that is similar to that of his parents where are the instructions stored that pro
    8·1 answer
  • Technician A that shielding gas nozzles may have different shapes. Technician B says that gelding gas nozzles is attached to the
    8·1 answer
  • The compression ratio of most small gasoline engines falls between_______and________.
    13·2 answers
  • Technician A says that the starter solenoid switches the high current on and off. Technician B says that the solenoid on the sta
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!