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]
4 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]4 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
Which group might be classified as a gang?
Furkat [3]

Answer:

The following criteria are commonly used for classifying groups as gangs: The group has three or more members, generally aged 12–24. Members share an identity, typically linked to a name, and often other symbols. Members view themselves as a gang, and they are recognized by others as a gang.

Explanation:

8 0
3 years ago
Read 2 more answers
A program is seeded with 30 faults. During testing, 21 faults are detected, 15 of which are seeded faults and 6 of which are ind
Vesna [10]

Answer:

Estimated number of indigenous faults remaining undetected is 6

Explanation:

The maximum likelihood estimate of indigenous faults is given by,

N_F=n_F\times \frac{N_S}{n_S} here,

n_F = the number of unseeded faults = 6

N_S = number of seeded faults = 30

n_s = number of seeded faults found = 15

So NF will be calculated as,

N_F=6\times \frac{30}{15}=12

And the estimate of faults remaining is  N_F-n_F = 12 - 6 = 6

8 0
3 years ago
A 6V battery is connected in series with two bulbs. What would the voltage drop be across each bulb?
Vitek1552 [10]

Answer:

3V

Explanation:

6 0
3 years ago
A six-lane freeway (three lanes in each direction) in rolling terrain has 10-ft lanes and obstructions 5 ft from the right edge.
Anon25 [30]
That is too hard but u got that cuz i believe in you!!!
3 0
3 years ago
Yo can someone find me an e-boy?
Vera_Pavlovna [14]
I got a friend how old are you and are you ok dating a bi guy
4 0
4 years ago
Other questions:
  • Signal generator‘s internal impedance is purely resistive and has an open-circuit voltage of 3.5 V. When the generator is loaded
    11·1 answer
  • ANSWER QUICK<br>Why did Winston Churchill take over for Neville Chamberlain shortly after ww2? ​
    9·1 answer
  • A process involves the removal of oil and other liquid contaminants from metal parts using a heat-treat oven, which has a volume
    10·1 answer
  • Consider a regenerative gas-turbine power plant with two stages of compression and two stages of expansion. The overall pressure
    11·1 answer
  • The air velocity in the duct of a heating system is to be measured by a Pitot-static probe inserted into the duct parallel to th
    13·1 answer
  • Consider a 0.15-mm-diameter air bubble in a liquid. Determine the pressure difference between the inside and outside of the air
    10·1 answer
  • NASA SPACE SHUTTLE QUESTION:
    14·1 answer
  • How do people eat with there noses shut
    12·2 answers
  • ¿Por qué la lógica de proposiciones es conocida también como lógica de las proposiciones sin analizar?
    11·1 answer
  • How can the use of local materials improve the standard of living of Filipinos?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!