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
The following is a sequence of undo-log records written by two transactions T and U: &lt; START T&gt;; ; &lt; START U&gt;; ; ; ;
tatiyna

Answer:

Giving that: The following is a sequence of undo-log records written by 2 transactions T and U:

< START T >;

< T,A,10 >;

< START U >;

< U, B, 20 >;

< T, C, 30 >;

< U, D, 40 >;

< Commit U >;

< T, E, 50 >;

< Commit T >;

1. < START U >

      Recovery action in this case will be undo(-1) and undo(0). All restored to its original Value

     log records < T, A, 10 >,  < T, abort >; as written out

2. < T, E, 50 >

      Recovery action in this case will be undo(8) and redo(0). A and C is restored to its original value, B and D are set to 20 and 40

      log records <T, C, 30 >,  < T, A, 10 >,  < T, abort >  are written out

3. < Commit T >

      Recovery action in this case will be redo(7) and redo(4). A and C are set to 10 and 30, B and D are set to 20 and 40

7 0
3 years ago
Mary works for a multimedia firm, and she spends long hours on a desktop computer. Recently, she expired back pain and visited h
Sindrei [870]

To stand as she works.

5 0
2 years ago
Which of the following actions is most likely to be effective in reducing the digital divide at a local level? A Creating an app
Mekhanik [1.2K]

Answer: C

Explanation:

4 0
2 years ago
What must you do to enable the members of the rome backup group to perform backup operations on the local system?
steposvetlana [31]
Add Rome Backup group to a membership list of a group that already has access to perform backup operations on the local system. Thank you for posting your question here at brainly. I hope the answer will help you. Feel free to ask more questions here.
5 0
3 years ago
A method to accept the number of drawers in the desk as input from the key board. This method returns the number of drawers to t
Julli [10]

Answer:

Following code takes the information about the wood from the user, do the process of calculating the value according to there type and numbers, then add the surcharge to it while giving the answer to the user.

For differentiating the type of woof i used the if then else statement while i used switch case statement for assigning the appropriate value according to the types of the wood will be processing in the program.

The code is given below:

Explanation:

Code:

namespace std;\\ any name instead of std.

{

   class Program

   { \\ starting the main program

       static void Main(string[ ] args)

       {

           int numberOfDrawers = 0;

           string deskWoodType = "o";

           double cost = 0;

           drawersMeth(numberOfDrawers);

           woodTypeMeth(deskWoodType);

           CalculateCostMeth(numberOfDrawers, cost, deskWoodType);

           OutPutCostMeth(deskWoodType , cost, numberOfDrawers);

       }//end main

       private static void drawersMeth(int numberOfDrawers)

       {

           int numOfDrawers;

           Console.WriteLine("Enter the number of desk drawers");

           numOfDrawers = Convert.ToInt16(Console.ReadLine());

           numberOfDrawers = numOfDrawers;

       }//end drawersMeth

       private static string woodTypeMeth(string deskWoodType)

       {

           Console.WriteLine("Enter the desk wood type. (eg. type mahogany, oak, or pine)");

           deskWoodType = Convert.ToString(Console.ReadLine());

           switch (deskWoodType)

           {

               case "mahogany":

                   {

                       deskWoodType = "m";

                       break;

                   }

               case "oak":

                   {

                       deskWoodType = "o";

                       break;

                   }

               case "pine":

                   {

                       deskWoodType = "p";

                       break;

                   }

               default:

                   {

                       deskWoodType = "error";

                       break;

                   }

           }

           return deskWoodType;

       }// end woodTypeMeth

       private static int CalculateCostMeth(string deskWoodType, int numberOfDrawers, int cost)

       {

           int pine = 100;

           int oak = 140;

           int other = 180;

           int surchage = 30;

           if (deskWoodType == "p")

               cost = surchage + (numberOfDrawers *pine );

           else if (deskWoodType == "o")

               cost = surchage + (numberOfDrawers *oak );

           else

               cost = surchage + (numberOfDrawers *other );

           return cost;

       }// end CalculateCostMeth

       private static void OutPutCostMeth(int numberOfDrawers, string deskWoodType, int cost)

       {

           double totalCost = cost;

           Console.WriteLine("The number of drawers is {0}", numberOfDrawers);

           Console.WriteLine("The wood finish you have selected is ", deskWoodType);

           Console.WriteLine("The total cost is {0}", totalCost);

       }//end outputCost

   }//end class

}//end nameSpace

5 0
3 years ago
Other questions:
  • Brenda wants to finish her presentation with a summary slide . She wants three key messages to appear on each of the photo clips
    6·2 answers
  • If you are planning to carry a large balance on your credit card, which of the following credit card features should you look fo
    7·2 answers
  • Which is a real-world example of a procedure?
    11·1 answer
  • Programmers insert documentation called facts into the program code.? <br> a. True <br> b. False
    9·1 answer
  • Which type of computer operating system would be best for a large corporation?
    7·2 answers
  • Provide a few examples of how cryptography actually secures data.
    8·1 answer
  • When a company sends you recommendations of what to buy you know that :
    12·1 answer
  • What is the best food to eat before workout? why?​
    10·2 answers
  • What ribbon command on the home tab can you use to change a cell fill color
    5·2 answers
  • Some hackers are skillful computer operators, but others are younger inexperienced people who experienced hackers refer to as?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!