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
weqwewe [10]
4 years ago
8

Given positive integer numInsects, write a while loop that prints that number doubled without reaching 200. Follow each number w

ith a space. After the loop, print a newline. Ex: If numInsects = 16, print:16 32 64 128 import java.util.Scanner;public class InsectGrowth {public static void main (String [] args) {int numInsects;Scanner scnr = new Scanner(System.in);numInsects = scnr.nextInt(); // Must be >= 1/* Your solution goes here */}}
Computers and Technology
1 answer:
True [87]4 years ago
5 0

Answer:

The below code is pasted in the place of "/*Your solution goes here */"

while(numInsects<200) // while loop

       {

            System.out.print(numInsects+" "); // print statement

            numInsects=numInsects*2; // operation to print double.

       }

Output:

  • If the user gives inputs 16 then the output is 16 32 64 128.
  • If the user gives inputs 25 then the output is 25 50 100.

Explanation:

  • The above code is in java language in which the code is pasted on the place of "Your solution" in the question then only it can work.
  • Then the program takes an input from the user and prints the double until the value of double is not 200 or greater than 200.
  • In the program, there is while loop which checks the value, that it is less than 200 or not. If the value is less the operation is performed otherwise it terminates.
You might be interested in
A speech why friends are important 2 min​
Gnoma [55]

Friends can challenge us, confuse us, and sometimes, we might wonder why we bother. But friendship is as important to our wellbeing as eating right and exercising. What’s more, friendships help us grow through each year of our lives.

The friends we meet in school teach us how to be patient, wait our turn, reach out, and try new hobbies. When we move into young adulthood we learn more about taking responsibility, finding a career path, and seeking out people as mentors.

As we continue into our 40s and beyond, we learn to weather the ups and downs in life, and once again friends provide a sounding board and place for us to grow. Friendship is key to our success with all our relationships and it can create a sense of purpose in our lives.

The people we bring into our lives as friends will show us how to forgive, laugh, and make conversation. The basic components of any relationship, from our marriage to our coworkers, are all founded in friendship. We learn how to interact with people because of our friends, even the ones that are opposite from us or share a different worldview.

We don’t just talk with others but learn from them. We understand the process of meeting new acquaintances and finding out what makes them tick. These people help push us out of our comfort zones while still providing a safe emotional space for us to be totally ourselves.

One of the most overlooked benefits of friendship is that it helps keep our minds and bodies strong. In fact, it’s as important to our physical health as eating well and keeping fit. A recent Harvard study concluded that having solid friendships in our life even helps promote brain health.

4 0
3 years ago
Five uses of the start button
Damm [24]

Starting something

Possibly turning it off

Making something work

Fixing the Start Button

Beginning something

5 0
3 years ago
You are most likely to use<br> images for photos or digital paintings.
Lubov Fominskaja [6]

Answer: Digital Paintings

7 0
3 years ago
Write the code to call a function named send_variable and that expects a single int parameter. Suppose a variable called x refer
NemiM [27]

Answer:

<em>#include <iostream></em>

<em>using namespace std;</em>

<em>//function definition</em>

<em>void send_variable(int num){</em>

<em>    cout<<"The Number is "<<num<<endl;</em>

<em>}</em>

<em>// main function begins here</em>

<em>int main()</em>

<em>{</em>

<em>    int x =15; //declares an it variable and assigns 15</em>

<em>    // Calls the function send_variable</em>

<em>    send_variable(x);</em>

<em>    return 0;</em>

<em>}</em>

Explanation:

Using C++ programming language we created the function called send_variable and in the main function we call this function which only displays the value of an int variable passed unto it.

6 0
3 years ago
Menciona dos ventajas que ofrece el procesador de textos word
Drupady [299]

Answer:

si porque si y me gusta comer papas fritas heello

8 0
3 years ago
Other questions:
  • Gaetan has attempted to enter the passcode for his mobile device but keeps entering the wrong code. Now he is asked to enter a s
    12·1 answer
  • In which phase of the design process does the developer establish the project goals? A. Design B. Planning C. Development D. Lea
    15·2 answers
  • A #1 Phillips screwdriver has a shaft diameter of 
    13·1 answer
  • A technician has been asked to troubleshoot a simple network problem that seems to be caused by software. Which troubleshooting
    7·1 answer
  • A BufferedReader has a constructor that takes a single InputStreamReader parameter. InputStreamReader has a constructor that tak
    8·1 answer
  • Case-Based Critical Thinking Questions​Case 1: Tony’s Pizza &amp; Pasta​Tony’s Pizza &amp; Pasta restaurant uses an application
    9·1 answer
  • Deon plans to ride a 15 mile bicycle trail.his if his average is 20 miles per hour
    15·1 answer
  • Why is it important to put the most specific case first? What types of errors does it help avoid?
    11·1 answer
  • - A blacksmith is shoeing a miser's horse. The blacksmith charges ten dollars for his work. The miser refuses to pay. "Very well
    6·1 answer
  • I need solutions to below questions with python code:
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!