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
Discuss four (4) advantages of direct and indirect water supply system.
Reil [10]

Answer and Explanation:

Some of the advantages of direct water supply system are:

  • Smaller size of the cistern
  • No risk of polluted water
  • Ease of installation
  • Lower pipe work

Some of the advantages of indirect water supply system are:

  • It can be pumped completely
  • Lower demand on the main source
  • Minimization of wear and tear on taps
  • Larger size of the cistern.
7 0
3 years ago
Read 2 more answers
What kind of situations breaks the causal link?
34kurt

Answer:A novus actus

8 0
3 years ago
what problem was the team presented within this episode? What problem mine they have thought they should solve if they hadn’t li
jok3333 [9.3K]

Explanation:

whats

the question choices

8 0
3 years ago
Câu 1: Tìm từ trong 2 câu thơ sau liên quan đến các từ: hình chiếu, tia chiếu, mặt phẳng chiếu.
xeze [42]

Explanation:

are bhai brainly aap english me questions kar ne ko hai

ye kon si bhasha hai ??????

4 0
3 years ago
Users of E85 see a drop in gas mileage because ethanol can't produce the same
liraira [26]

Answer:

A

Explanation:

Due to ethanol's lower energy content, FFVs operating on E85 get roughly 15% to 27% fewer miles per gallon than when operating on regular gasoline, depending on the ethanol content.

7 0
3 years ago
Other questions:
  • A certain full-wave rectifier has a peak output voltage of 30 V. A 50 mF capacitor-input filter is connected to the rectifier. C
    6·1 answer
  • Air is drawn from the atmosphere into a turbomachine. At the exit, conditions are 500 kPa (gage) and 130oC. The exit speed is 10
    8·1 answer
  • Paragraph summary on airplane history
    8·1 answer
  • For each of the three products that are observed in the NMR spectrum, there is a diagnostic proton that can be used to accuratel
    6·1 answer
  • A 75-g projectile traveling at 600 m/s strikes and becomes embedded in a 50-kg block, which is initially stationary. Compute the
    9·1 answer
  • A 200 Ω transmission line is to be matched to a computer terminal with ZL = (50 − j25) Ω by inserting an appropriate reactance i
    10·1 answer
  • What are the pros and cons of cooking with each type of heat source (solar vs fossil fuel)
    13·1 answer
  • Determine the voltage which must be applied to a 1 k 2 resistor in order that a current of
    10·1 answer
  • An example of Analog Data would be:
    8·1 answer
  • Q1. (20 marks) Entropy Analysis of the heat engine: consider a 35% efficient heat engine operating between a large, high- temper
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!