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
When hermetic refrigerant motor-compressors are designed to operate continuously at currents greater than 156 percent of the rat
ANEK [815]

The nameplate of a hermetic refrigerant motor-compressor that is designed to operate continuously at currents greater than 156% of the rated-load current is marked with branch-circuit selection current.

<h3>What is a hermetic refrigerant motor-compressor?</h3>

A hermetic refrigerant motor-compressor can be defined as a mechanical device that is designed and developed by combining a compressor and motor in a single outer-welded steel shell.

Basically, a hermetic refrigerant motor-compressor is used in the following areas:

  • Household refrigerators
  • Freezers
  • Heat pumps
  • Air coolers
  • Water cooling equipment.
  • Small refrigeration equipment.

According to HSE, the nameplate of a hermetic refrigerant motor-compressor that is designed to operate continuously at currents greater than 156% of the rated-load current is marked with branch-circuit selection current, so as to ensure safety for end users and technicians.

Read more on refrigerants here: brainly.com/question/2928084

6 0
3 years ago
Two technicians are discussing relays. Technician A says that relays can fail because the relay winding is open. Technician B sa
hram777 [196]

Technician A says that relays can fail because the relay winding is open. Technician A is correct.

<h3>What is winding?</h3>

A single turn of the wound material, which is material wrapped or coiled around an object.

Poor contact alignment and open coils can also cause relays to malfunction.

The most important aspect impacting relay dependability is choosing the right relay type for a particular application. When incorporating them into circuits, several subpar design techniques are employed.

Hence, technician A is correct.

To learn more about the winding refer;

brainly.com/question/23369600

#SPJ1

4 0
2 years ago
Briefly explain why small-angle grain boundaries are not as effective in interfering with the slip process as are high-angle gra
Vlada [557]

Answer:

Explanation:

Small-angle grain boundaries are not as effective in interfering with the slip process as are high-angle grain boundaries because there is not as much crystallographic misalignment in the grain boundary region for small-angle, and therefore not as much change in slip direction.

Low angle grain boundaries (quasi-coherent) are formed by the dislocation network positioned along the geometric plane with small tilt angle differences between successive peers that is tilt boundary made up edge dislocations therefore it may only divert the slip direction of the incoming gliding dislocation with very little frictional stresses. And on the other hand, a high angle grain boundary region because of their disordered almost liquid like structure which acts as a strong barrier against dislocation slip motion and causes actually formation of dislocations file-up against it by arresting their motion unless that the stress concentration at the leading dislocation becomes high enough to go though the barrier.

5 0
4 years ago
1)What are the three previous manufacturing revolutions Mr. Scalabre mentions? When did these take place?
Ostrovityanka [42]

The three previous manufacturing revolutions that Mr. Scalabre mentioned and their year of occurrence are:

  1. The steam engine in the mid-19th Century
  2. The mass-production model in the early 20th Century
  3. The first automation wave in the 1970s

<h3>What is a Manufacturing Revolution?</h3>

This refers to the process of change from a handicraft economy to industry production-based production.

Hence, we can see that Mr. Scalabre believes we are not growing in productivity because there has not been enough automation to perform the tasks needed.

The effect of robotics is making an impact on productivity because a lot of complex, difficult tasks are done by machines.

3D printing has made an impact on productivity because there is a reduction in the pressing cycle and errors due to negligence are reduced.

The role the engineers have to play in the next revolution is that they would have to produce mathematical model that can be used to produce better AIs

Read more about manufacturing revolutions here:

brainly.com/question/14316656

#SPJ1

8 0
2 years ago
A circular ceramic plate that can be modeled as a blackbody is being heated by an electrical heater. The plate is 30 cm in diame
MakcuM [25]

Answer:

Heater power = 425 watts

Explanation:

Detailed explanation and calculation is shown in the image below

6 0
3 years ago
Other questions:
  • Does a thicker core make an electromagnet stronger?
    13·1 answer
  • Air is compressed in a piston-cylinder device. List three examples of irreversibilities that could occur
    13·1 answer
  • Two AAA-size lithium batteries are connected in series in a flashlight. Each battery has 3.5 volt and 4- Amp-hour capacity. If t
    8·1 answer
  • Q1. In electronic circuits it is not unusual to encounter currents in the microampere range. Assume a 35 μA current, due to the
    13·1 answer
  • The water behind Hoover Dam is 206m higher than the Colorado river below it. At what rate must water pass through the hydraulic
    15·2 answers
  • List two possible reasons the engine oil could have a strong gasoline smell
    15·1 answer
  • - Consider a 2024-T4 aluminum material with ultimate tensile strength of 70 ksi. In a given application, a component of this mat
    7·1 answer
  • Joe, a technician, is attempting to connect two hubs to add a new segment to his local network. He uses one of his CAT5 patch ca
    9·1 answer
  • What is the difference between a series circuit and a parallel circuit?
    11·2 answers
  • Global climate and weather patterns are driven by differences in the amount of heat energy in different areas of the earth. Whic
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!