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
What is the output of a system with the transfer function s/(s + 3)^2 and subject to a unit step input at time t = 0?
Dominik [7]

Answer:

0

Explanation:

output =transfer function H(s) ×input U(s)

here H(s)=\frac{s}{(s+3)^2}

U(s)=\frac{1}{s} for unit step function

output =H(s)×U(s)

=\frac{s}{(s+3)^2}×\frac{1}{s}

=\frac{1}{(s+3)^2}

taking inverse laplace of output

output=t×e^{-3t}

at t=0 putting the value of t=0 in output

output =0

3 0
3 years ago
Refrigerant-134a at 700 kPa, 70°C, and 7.2 kg/min is cooled by water in a condenser until it exists as a saturated liquid at the
alex41 [277]

Answer:

The mass flow rate of cooling water required to cool the refrigerant is 123.788\,\frac{kg}{min}.

Explanation:

A condenser is a heat exchanger used to cool working fluid (Refrigerant 134a) at the expense of cooling fluid (water), which works usually at steady state. Let suppose that there is no heat interactions between condenser and surroundings.The condenser is modelled after the First Law of Thermodynamics, which states:

\dot Q_{ref} - \dot Q_{w} = 0

\dot Q_{ref} = \dot Q_{w}

\dot m_{ref}\cdot (h_{ref, in} - h_{ref,out}) = \dot m_{w}\cdot (h_{w, out} - h_{w,in})

The mass flow rate of the cooling water is now cleared:

\dot m_{w} = \dot m_{ref }\cdot \frac{h_{ref,in}-h_{ref,out}}{h_{w,out}-h_{w,in}}

Given that h_{ref,in} = 808.34\,\frac{kJ}{kg}, h_{ref, out} = 88.82\,\frac{kJ}{kg}, h_{w,out} = 104.83\,\frac{kJ}{kg} and h_{w,in} = 62.98\,\frac{kJ}{kg}, the mass flow of the cooling water is:

\dot m_{w} = \left(7.2\,\frac{kg}{min} \right)\cdot \left(\frac{808.34\,\frac{kJ}{kg}-88.82\,\frac{kJ}{kg} }{104.83\,\frac{kJ}{kg}-62.98\,\frac{kJ}{kg} } \right)

\dot m_{w} = 123.788\,\frac{kg}{min}

The mass flow rate of cooling water required to cool the refrigerant is 123.788\,\frac{kg}{min}.

4 0
3 years ago
g A primary sedimentation basin is designed for an average flow of 0.3 m3/s. The TSS concentration in the influent is 240 mg/L.
yarga [219]

Answer:

(a) 0.243 m3/day

(b) 96 mg/l

(c) 0.426 m3/min

Explanation:

The sludge has an average solids concentration of 4 percent and considering TSS concentration in the influent of 240 mg/L then solids in sludge will be 0.04*240= 9.6 mg/L

Considering the average flow of 0.3 m3/s then mass of sludge per day will be given by 0.3*1000*9.6*60*60*24/1000000=248.832 kg/day

To get volume, considering specific gravity given as 1.025 and taking density of water as 1000 kg/m3 then density of sludge is 1025 kg/m3

Volume is mass/density hence 248.832/1025=0.2427629268292 m3/day

Approximately, the volume of sludge is 0.243 m3/day.

(b)

Efficiency of 60 percent is equivalent to 0.6

Efficiency=(influent concentration- flow rate)/influent concentration

0.6=(240-flow rate)/240

Flow rate= 96 mg/l

(c)

Cycle time= 0.243/0.57=0.4263157894736 m3/min

Rounded off, cycle time is 0.426 m3/day

3 0
3 years ago
What is the<br> engineering
Oliga [24]

<em>Engineering</em><em> </em><em>is</em><em> </em><em>the</em><em> </em><em>profession</em><em> </em><em>which</em><em> </em><em>deals </em><em>with</em><em> </em><em>building</em><em> </em><em>the</em><em> </em><em>structures</em><em> </em><em>like</em><em> </em><em>bridge</em><em>,</em><em>house</em><em>,</em><em>roads</em><em> </em><em>etc</em><em>.</em>

<em>Hope</em><em> </em><em>it</em><em> </em><em>helps</em><em>.</em><em>.</em><em>.</em>

8 0
3 years ago
Read 2 more answers
When the Challenger spacecraft exploded, which design step had not been thoroughly explored?
Llana [10]

Answer:

The escape systems not working

8 0
2 years ago
Other questions:
  • A mysterious device found in a forgotten laboratory accumulates charge at a rate specified by the expression gm = 9 - 10tC from
    13·1 answer
  • Your study space does not need to be quiet as long as you can ignore any noise coming from the space true or false?
    9·2 answers
  • A 132mm diameter solid circular section​
    5·1 answer
  • Maggie discovered that a pipe in her basement has sprung a leak. She calls a plumber but in the meantime she grabs a roll of duc
    11·1 answer
  • A wing generates a lift L when moving through sea-level air with a velocity U. How fast must the wing move through the air at an
    7·1 answer
  • a coiled spring is stretched 31.50 cm by a 2.00N weight. How far is it stretched by a 10.00 N weight?
    6·1 answer
  • Wireless technology has made communicating
    15·1 answer
  • What is the best countermeasure against social engineering?
    11·1 answer
  • What is the primary damage control telephone circuit for
    12·1 answer
  • Why not just put all the set up steps within each step? it is because we want to keep our code __ ? (3 letters)
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!