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]
2 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]2 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]2 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
Assume that a file contains students' ids, full names, and their scores (Assignments grade, quizzes grade,
elixir [45]

Answer:

اope its heمحبعم

Explanation:

3 0
2 years ago
Which invention replaced vacuum tubes in computers?
dlinn [17]

Answer:

Transistors

Explanation:

6 0
2 years ago
Which of the following is an example of a stereotype?
amm1812

Answer:

d)"I have a really bad feeling about her. I don't know why."

Explanation:

5 0
2 years ago
Homework: Insertion Sort
Serga [27]

Answer:

Explanation:

I have written the code in Java. It contains the class Insertion Sorter which has the InsertionSort function. This function uses the insertion sort algorithm to sort a comparable array and if it fails to do so for whatever reason it throws an Illegal ArgumentException. If it sorts the array correctly it returns the number of changes that needed to be made in order to correctly sort the array. Due to technical difficulties I have attached the code as a text document below and proof of output in the picture below as well.

3 0
2 years ago
Write a program in C++ to implement bubblesort using the swap function ?
marishachu [46]

C++ program for implementation of Bubble sort  

#include <bits/stdc++.h>  

using namespace std;  

 void swap(int *x, int *y)  /*Defining Swap function of void return type*/

{  

  int temp = *x;  //Swaping the values  

   *x = *y;  

   *y = temp;  

}  

void bubbleSort(int array[], int n) /*Defining function to implement bubbleSort  */

{  

  int i, j;  

  for (i = 0; i < n-1; i++)      

      for (j = 0; j < n-i-1; j++)  /*The last i components are already in location  */

      if (array[j] > array[j+1])  

          swap(&array[j], &array[j+1]);  //Calling swap function

}  

int main()  //driver function

{  

   int array[] = {3, 16, 7, 2, 56, 67, 8}; //Input array  

   int n = sizeof(array)/sizeof(array[0]);  //Finding size of array

   bubbleSort(array, n); //Function calling  

   cout<<"Sorted array: \n";  

   for (int i = 0; i < n; i++)  //printing the sorted array

       cout << array[i] << " ";  

   cout << endl;  

 return 0;  

}  

<u>Output</u>

Sorted array:  

2 3 7 8 16 56 67

3 0
3 years ago
Other questions:
  • Research information technology affects on job market, career pathways, occupational outlooks in business and finance and synthe
    7·1 answer
  • What are the pasting options in Outlook 2016? Check all that apply.
    10·2 answers
  • The part of the computer that contains the brain or the Central Park nursing unit is also known as
    10·1 answer
  • Communication is defined as__________.
    10·1 answer
  • How do you copy and paste plz let me know
    14·2 answers
  • if the bandwidth-delay product of a channel is 500 Mbps and 1 bit takes 25 milliseconds to make the roundtrip, what is the bandw
    6·1 answer
  • Which of the following are incident priorities?
    9·1 answer
  • 1. Light of wavelength 900x10-9 m is emitted by a source. What is its frequency?​
    5·1 answer
  • Arrays of structures ________. Group of answer choices None of the above. are automatically passed by reference cannot be passed
    6·1 answer
  • ...................is a high level, structured , open source programming language​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!