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
umka2103 [35]
3 years ago
8

Given positive integer num_insects, write a while loop that prints that number doubled up to, but without exceeding 100. Follow

each number with a space. Sample output with input: 8 8 16 32 64
Computers and Technology
1 answer:
nasty-shy [4]3 years ago
5 0

Answer:

import java.util.Scanner;

public class CocaColaVendingTest {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter value for number of insects");

       int num_insects = in.nextInt();

       while (num_insects<=100){

           System.out.print(num_insects);

           num_insects*=2;

           System.out.print(" ");

       }

   }

}

Explanation:

In the code above written in Java.

The user is prompted to enter a positive value for the number of insects

This is stored in a variable num_insects.

Using a while loop with the condition while (num_insects<=100). The num_insects is printed out. Then it is doubled followed with a space.

It continues until the condition in the while loop is no longer true

You might be interested in
I am in need of a research topics in networking and security?​
cricket20 [7]
No, you will be fine.
8 0
4 years ago
Which of the following is a good technique to use when driving in an urban environment
nadya68 [22]

Answer:

A. Passing

Explanation:

Passing is a good technique to use when driving in an urban environment .

5 0
3 years ago
Read 2 more answers
What is the full form of HTML​
Naya [18.7K]

Answer:

hypertext markup language

3 0
3 years ago
I think these might be the answers but im not to sure, so am I right? or wrong? please help
mina [271]
Number 1 and 4 are the same? I agree with your answers.
4 0
3 years ago
Read 2 more answers
List out the input and output device .​
Dmitry [639]

Computer - Input Devices

Keyboard.

Mouse.

Joy Stick.

Light pen.

Track Ball.

Scanner.

Graphic Tablet.

Microphone.

Computer - Output Devices

Monitor.

Printer.

Headphones.

Computer Speakers.

Projector.

GPS.

Sound Card.

Video Card.

5 0
3 years ago
Read 2 more answers
Other questions:
  • _____ is when network managers deal with network breakdowns and immediate problems instead of performing tasks according to a we
    9·1 answer
  • What observational data required the revision of the early geocentric model?
    5·1 answer
  • Two users, UserA and UserB, are engaging in secure communication using only asymmetrical encryption. UserA needs to send a secur
    11·1 answer
  • What type of device is the printer?
    13·2 answers
  • The new ICH E6(R2) integrated addendum requires sponsors to implement systems to manage quality throughout all stages of the tri
    13·1 answer
  • What are those jackets called the ones with lots of straps inside, like in movies where they store there ammo etc?
    13·1 answer
  • What are 6 steps to take to figure out what's wrong with your computer?
    5·1 answer
  • Select the parts of a business letter.
    6·2 answers
  • How many passes will it take to find the 20 in this list? (python)
    11·2 answers
  • Helen is working on her colleague’s photos. She came across this particular photo and was confused about which effect the photog
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!