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

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 newline Ex: For the user input 123, 395, 25, the expected output is:

Computers and Technology
2 answers:
nataly862011 [7]3 years ago
4 0

Complete Question:

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

Answer:

import java.util.Scanner;

public class num8 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       int n;

       do{

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

           n= in.nextInt();

       }while(n>100);

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

   }

}

Explanation:

Using Java programming language

Import the scanner class to receive user input

create an int variable (n) to hold the entered value

create a do while loop that continuously prompts the user to enter a number less than 100

the condition is while(n>100) It should continue the loop (prompting the user) until a number less than 100 is entered.

lara [203]3 years ago
4 0

Answer:

do{

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

           userInput = scnr.nextInt();

        } while(userInput > 100);

Explanation:

You might be interested in
Who does Potholes effect in South Africa?
Morgarella [4.7K]
By definition, a pothole is a structure mostly located at the surface of roads and highways wherein it is usually characterised by having deep crevices which are primarily caused by extreme soil erosion or the presence of water in the area. In addition, these potholes greatly affect the transportation system of South Africa because the flow of traffic will be interrupted.
4 0
3 years ago
It is a JavaScript property used to call a function after a specified time, in milliseconds​
AVprozaik [17]

Answer:

setTimeout is a native JavaScript function (although it can be used with a library such as jQuery, as we'll see later on), which calls a function or executes a code snippet after a specified delay (in milliseconds).

8 0
3 years ago
Read 2 more answers
Which block in this module represents the variable?
sasho [114]

Explanation:

jdbfifnmathljnfeijrjdjej.http.com

6 0
2 years ago
Which of the following is a precaution that helps to protect you from electric shock when working with electric power tools?
olga2289 [7]
A A is the best answer to this question.
5 0
3 years ago
Read 2 more answers
Flesh out the body of the print_seconds function so that it prints the total amount of seconds given the hours, minutes, and sec
fiasKO [112]

Answer:

Step by step explanation along with code and output is provided below

Explanation:

#include<iostream>

using namespace std;

// print_seconds function that takes three input arguments hours, mints, and seconds. There are 60*60=3600 seconds in one hour and 60 seconds in a minute. Total seconds will be addition of these three  

void print_seconds(int hours, int mints, int seconds)

{

   int total_seconds= hours*3600 + mints*60 + seconds;

   cout<<"Total seconds are: "<<total_seconds<<endl;

}

// test code

// user inputs hours, minutes and seconds and can also leave any of them by  entering 0 that will not effect the program. Then function print_seconds is called to calculate and print the total seconds.

int main()

{

   int h,m,s;

   cout<<"enter hours if any or enter 0"<<endl;

   cin>>h;

   cout<<"enter mints if any or enter 0"<<endl;

   cin>>m;

   cout<<"enter seconds if any or enter 0"<<endl;

   cin>>s;

   print_seconds(h,m,s);

  return 0;

}

Output:

enter hours if any or enter 0

2

enter mints if any or enter 0

25

enter seconds if any or enter 0

10

Total seconds are: 8710

8 0
3 years ago
Other questions:
  • Based on the current economic situation do you expect the employment demand for graduating engineers to increase or decrease? Ex
    9·1 answer
  • Which is a function of network media?
    11·2 answers
  • Refer to the exhibit, a technician applies the configuration in the exhibit to an unconfigured router. To verify the configurati
    13·1 answer
  • which one of the following word process feature saves you the most time when you keying in a document
    9·1 answer
  • ___________ is a document that describes the locations of variables in the data file and lists the assignments of codes to the a
    12·1 answer
  • Rounding up and down for 389,422
    7·1 answer
  • Diligent people are as concerned with the ____ as the ___ of their work
    12·1 answer
  • What is the main difference between a search engine and a web browser?
    6·2 answers
  • Bro i swear whenever i play fortnite duos, they ask you if you don't have a mic, if you don't then they just leave, so annoying
    15·2 answers
  • Please help me with these questions. Thanks o((&gt;ω&lt; ))o
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!