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
Llana [10]
3 years ago
6

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;
}
Computers and Technology
2 answers:
OLEGan [10]3 years ago
8 0

Answer:

#include <iostream>

using namespace std;

int main()

{

   int userInput = 0;

   do {

       cout << "Enter a number (<100):" << endl;

       cin >> userInput;

   }

   while(userInput >= 100);

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

   return 0;

}

Explanation:

Inside the <em>do part</em>, ask user to enter a number and get that number.

In the <em>while</em>, check if the number is greater than or equal to 100. It is going to keep asking to enter a number until a number that is smaller than 100 is entered.

Print out the number that is smaller than 100.

shtirl [24]3 years ago
3 0

Answer:

import java.util.Scanner;

public class NumberPrompt {

  public static void main (String [] args) {

     Scanner scnr = new Scanner(System.in);

     int userInput = 0;

     

     do {

         System.out.println("Enter a number (<100):");  

         userInput = scnr.nextInt();

     }

       while(userInput >= 100);

     System.out.println("Your number < 100 is: " +userInput);

     

     

        }

}

   

           

         

Explanation:

Answer in java

You might be interested in
To delete only the selected contents of the table, but not the table itself, ____.
Volgvan

To delete only the selected contents of the table, but not the table itself, you need to click on this cell in the table.

6 0
3 years ago
A struck-by hazard can be described as anytime a worker ___________.
solong [7]
A...........................................
7 0
3 years ago
Read 2 more answers
The ArrayList class contains a trim method that resizes the internal array to exactly the capacity. The trim method is intended
andreev551 [17]

Answer:

public void trimToSize() {

modCount++;

if (size < elementData.length) {

elementData = (size == 0)

? EMPTY_ELEMENTDATA

: Arrays.copyOf(elementData, size);

}

}

Now, the running time for copyOf() function is O(N) where N is the size/capacity of the ArrayList. Hence, the time complexity of trimToSize() function is O(N).

Hence, the running time of building an N-item ArrayList is O(N^2).

Please find the sample code below.

CODE

==================

import java.util.ArrayList;

public class Driver {

  public static void main(String[] args) throws Exception{

      int N = 100000;

      ArrayList<Integer> arr = new ArrayList<>(N);

     

      long startTime = System.currentTimeMillis();

      for(int i=0; i<N; i++) {

          arr.add(i);

          arr.trimToSize();

      }

      long endTime = System.currentTimeMillis();

      double time = (endTime - startTime)/1000;

      System.out.println("Total time taken = " + time + " seconds.");

  }

}

Explanation:

5 0
3 years ago
Which best describes Sayid’s error?
Sonja [21]
<span>Change "move only through matter" to "move through space and matter."</span>
8 0
3 years ago
When you first purchase a notebook, make sure you have a ____ CD containing the installed OS so you can recover from a failed ha
stira [4]

When you first purchase a notebook, make sure you have a RECOVERY CD. It enables the restoration of the notebook computer.

A recovery disc is a disc that enables to restore the computer to the same condition when it was bought.

Moreover, a recovery drive refers to a separate partition in the notebook that must contain the required files to restore the device if the system becomes unstable.

A recovery disc can be considered as a drive used to keep a backup of the files (e.g., images) and other types of restoration data.

Learn more about recovery disc here:

brainly.com/question/14217813

5 0
2 years ago
Other questions:
  • 1. A video card on a modem motherboard would run best in which type of slot?
    10·1 answer
  • Which statement is true? Group of answer choices Variables cannot be assigned and declared in the same statement Variable names
    5·1 answer
  • Consider the attack scenario given below:
    8·1 answer
  • Describe safe motherhood​
    9·2 answers
  • How can I collect tweets from different accounts concurrently and categorize the tweets in a corpus?
    15·1 answer
  • ___________ is an approach to boundary spanning that results from using sophisticated software to search through large amounts o
    8·1 answer
  • Nuclear batteries use devices called thermocouples, which convert the ____ of a nuclear reaction into electricity.
    9·1 answer
  • Which of the following statements are true of
    14·1 answer
  • Project manager Kevin has to create a project team organizational chart. Which activity should he perform before creating this c
    9·1 answer
  • If a citation has a volume, title, and page numbers, it is a:
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!