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
yawa3891 [41]
3 years ago
12

Write a do-while loop that continues to prompt a user to enter a number less than 100, until the entered number is actually less

than 100. End each prompt with a newline. Ex: For the user input 123, 395, 25, the expected output is:
Enter a number (<100):
Enter a number (<100):
Enter a number (<100):
Your number < 100 is: 25
c++

#include
using namespace std;

int main() {
int userInput = 0;

do
cout << "Your number < 100 is: " << userInput << endl;

return 0;
}
Engineering
1 answer:
chubhunter [2.5K]3 years ago
8 0

Answer:

#include <iostream>//including iostream library to use functions such as cout and cin

using namespace std;

int main() {

int userInput = 0;

do

{

 cout << "Enter a number < 100: " ;

 cin >> userInput;

 if (userInput < 100)//condition if number is less than 100

 {

  cout << "Your number < 100 is: " << userInput << endl;

 }

} while (userInput > 100);//do while loop condition

return 0;

}

Explanation:

A do-while loop executes regardless in the first iteration. Once it has run through the first iteration, it checks if the condition is being met. If, the condition is TRUE, the loop begins the second iteration. If FALSE, the loop exits. In this case, the condition is the userInput. after the first iteration, lets say the userInput is 120, the condition userInput > 100 is true.Therefore, the loop will run again until eventually the number is less than hundred, lets say 25. In that case the condition would be 25 > 100, which would be false, so the loops will break.

You might be interested in
Under which of the following conditions is a Type B-1 Fire extinguisher required onboard a motorized vessel?
swat32

Answer:

The correct option is;

D. The vessel has closed living spaces onboard

Explanation:

Type B-1 Fire extinguishers

A fire extinguisher is required by the law to be installed in a boat that hs the following specifications

1) There are closed compartment in the boat that can be used for fuel storage

2) There exist double double bottom that is only partially filled with flotation materials

3) There are closed living spaces in the boat

4) The fuel tank is permanently installed in the boat

5) The engine is inboard.

7 0
3 years ago
Read 2 more answers
A saturated 1.5 ft3 clay sample has a natural water content of 25%, shrinkage limit (SL) of 12% and a specific gravity (GS) of 2
Svetllana [295]

79 f t^{3} is the volume of the sample when the water content is 10%.

<u>Explanation:</u>

Given Data:

V_{1}=100\ \mathrm{ft}^{3}

First has a natural water content of 25% = \frac{25}{100} = 0.25

Shrinkage limit, w_{1}=12 \%=\frac{12}{100}=0.12

G_{s}=2.70

We need to determine the volume of the sample when the water content is 10% (0.10). As we know,

V \propto[1+e]

\frac{V_{2}}{V_{1}}=\frac{1+e_{2}}{1+e_{1}}  ------> eq 1

e_{1}=\frac{w_{1} \times G_{s}}{S_{r}}

The above equation is at S_{r}=1,

e_{1}=w_{1} \times G_{s}

Applying the given values, we get

e_{1}=0.25 \times 2.70=0.675

Shrinkage limit is lowest water content

e_{2}=w_{2} \times G_{s}

Applying the given values, we get

e_{2}=0.12 \times 2.70=0.324

Applying the found values in eq 1, we get

\frac{V_{2}}{100}=\frac{1+0.324}{1+0.675}=\frac{1.324}{1.675}=0.7904

V_{2}=0.7904 \times 100=79\ \mathrm{ft}^{3}

7 0
3 years ago
When an electron in a valence band is raised to a conduction band by sufficient light energy, semiconductors start conducting __
garri49 [273]

Answer:

This band gap also allows semiconductors to convert light into electricity in photovoltaic cells and to emit light as LEDs when made into certain types of diodes. Both these processes rely on the energy absorbed or released by electrons moving between the conduction and valence bands.

Explanation:

On the internet

4 0
2 years ago
Given a two-dimensional steady inviscid air flow field with no body forces described by the velocity field given below. Assuming
kolbaska11 [484]

Answer:

the pressure gradient in the x direction = -15.48Pa/m

Explanation:

  • The concept of partial differentiation was used in the determination of the expression for u and v.
  • each is partially differentiated with respect to x and the appropriate substitution was done to get the value of the pressure gradient as shown in the attached file.

4 0
3 years ago
If you get a flat in the front of your car, your car will:
juin [17]

Answer:

stop and might even crash

Explanation:

6 0
2 years ago
Other questions:
  • The development team recently moved a new application into production for the accounting department. After this occurred, the Ch
    6·1 answer
  • A manufacturer makes two types of drinking straws: one with a square cross-sectional shape, and the other type the typical round
    9·1 answer
  • The outer surface temperature of a glass filled with iced water may drop below the dew-point temperature of the surrounding air,
    5·1 answer
  • Consider a normal shock wave in air. The upstream conditions are given by M1=3, p1 = 1 atm, and r1 = 1.23 kg/m3. Calculate the d
    15·1 answer
  • Which of the following statements about pitot-static systems is FALSE? a). A pitot probe measures the Total Pressure of the free
    10·1 answer
  • In a creep test, increasing the temperature will (choose the best answer) A. increase the instantaneous initial deformation B. i
    5·1 answer
  • What does the current in a semi-conductor is produced by?
    15·2 answers
  • What learning is required to become a mechanical engineer?
    14·1 answer
  • Explain crystallographic defects.
    11·1 answer
  • How much does it cost to replace a roof on a 2,200 square foot house.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!