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
Force = 33 newtons
kicyunya [14]

Answer:

answer

Explanation:

4 0
3 years ago
Which of these is the coarsest grit abrasive that may be used on aluminum?
natali 33 [55]

Answer:

80grit

Explanation:

80 grit is coarsest grit that may be used on aluminum

The lowest grit sizes range from 40 to 60. From the given options 80 grit is practically available grit.

What is a sandpaper used for?

They are essentially used for surface preparation. Sandpaper is produced in a range of grit sizes and is used to remove material from surfaces, either to make them smoother (for example, in painting and wood finishing), to remove a layer of material (such as old paint), or sometimes to make the surface rougher (for example, as a preparation for gluing).

5 0
3 years ago
Read 2 more answers
Design circuits that demonstrate all of the principles listed below. Set up the circuits and take measurements to show that the
Nata [24]

<u>Explanation</u>:

For series

\Delta V=V_{1}+V_{2}+\ldots+V_{n}=I R_{1}+I R_{2}+\ldots+I R_{n}(\text {voltages add to the batter } y)

\(I=I_{1}=I_{2}=I_{n}\) (current is the same)

V=I R(\text {voltage is directly proportional to } R)

R_{e q}=R_{1}+R_{2}+\ldots+R_{n} \quad \text { (resistance increase) }

For parallel

\Delta V=\Delta V_{1}=\Delta V_{2}=\Delta V_{n} \quad(\text { same voltage })

I=I_{1}+I_{2}+\ldots+I_{n}(\text {current adds})

\(I=\frac{\Delta V}{R_{e q}} \quad(R \text { inversal } y \text { proportional to } I)\)

\frac{1}{R_{e q}}=\frac{1}{R_{1}}+\frac{1}{R_{2}}+\ldots+\frac{1}{R_{n}}

3 0
4 years ago
What is the average linear (seepage) velocity of water in an aquifer with a hydraulic conductivity of 6.9 x 10-4 m/s and porosit
jeka94

Answer:

a. 0.28

Explanation:

Given that

porosity =30%

hydraulic gradient = 0.0014

hydraulic conductivity = 6.9 x 10⁻4 m/s

We know that average linear velocity given as

v=\dfrac{K}{n_e}\dfrac{dh}{dl}

v=\dfrac{6.9\times 10^{-4}}{0.3}\times0.0014\ m/s

v=3.22\times 10^{-6}\ m/s

The velocity in m/d      ( 1 m/s =86400 m/d)

v= 0.27 m/d

So the nearest answer is 'a'.

a. 0.28

4 0
3 years ago
What’s the difference between quality and quantity
Lesechka [4]
Quality is how good something is. Like how good the material is. Like the quality of the IPhone X is better than the quality of the iPhone 6s + because it has more features and can sustain better hold
Quantity is how much. Like the quantity of the m&ms were split evenly.
I dont know exactly if that makes sense but there ya go
YW!
4 0
3 years ago
Read 2 more answers
Other questions:
  • Which statement best describes how a hearing aid works?
    7·1 answer
  • OSHA does not approve individual states to have their own safety and health program.
    15·2 answers
  • Technician A says that a magnetic field can be created by current flow. Technician B says that current can be induced by moving
    5·1 answer
  • A baseband signal with a bandwidth of 100 kHz and an amplitude range of±1 V is to be transmitted through a channel which is cons
    8·2 answers
  • Which of the following is an example of seeking accreditation?
    7·1 answer
  • A field sample of an unconfined aquifer is packed in a test cylinder. The length and diameter of the cylinder are 50 cm and 6 cm
    9·1 answer
  • WHAT IS THE MOST POWERFUL PART IN A CAR
    13·2 answers
  • (Signal Property) Under what condition is a discrete-time signal x[????] or a continuous-time signal x(????) periodic? Determine
    5·1 answer
  • Two routes connect an origin and a destination. Routes 1 and 2 have performance functions t1 = 2 + X1 and t2 = 1 + X2, where the
    6·1 answer
  • 1. When and why should we use the Pattern option?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!