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
AveGali [126]
4 years ago
8

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

ith a space. After the loop, print a newline. Ex: If numInsects = 8, print:
8 16 32 64
import java.util.Scanner;

public class InsectGrowth {
public static void main (String [] args) {
int numInsects = 0;
Computers and Technology
1 answer:
DIA [1.3K]4 years ago
7 0

Answer:

import java.util.Scanner;

public class InsectGrowth {

   public static void main (String [] args) {

       int numInsects = 8;

       while(numInsects < 100){

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

           numInsects = numInsects *2;

       }

       System.out.println();

   }

}

Explanation:

Create the main function and define the variable numInsects with value 8.

Take the while loop and it run until numInsects less than 100.

Inside the loop. first print the value and less double the numInsects value.

for example:

suppose, numInsects  = 2

the, check condition 2 < 100, true

print(2)

numInsects  = 2* 2=4

second time, numInsects  = 4

the, check condition 4 < 100, true

print(4)

numInsects  = 4* 2=8

and so on, until  numInsects  < 100.

Print each number with space and finally when the loop is terminate print the new line.

You might be interested in
Question #5
stepladder [879]

Answer:

books.append({5:2})

Explanation:

got it right on edge 2020

4 0
3 years ago
Read 2 more answers
Truck drivers probably cannot see your vehicle if you cannot
inysia [295]

D is the answer to this question. It is very important for people to stay in the right positon before they hit the road.

7 0
3 years ago
Read 2 more answers
Why should a person consider doing an apprenticeship?
dedylja [7]
There are many good things that can come out of it. There is good job training opportunities as well as learning the ways of the place. you can learn how people in that area work as well as their pace,emotions toward each-other and even lifestyles. there are many good outcomes to doing it.
5 0
3 years ago
___________ are the constant values that are used in a program. ​
77julia77 [94]

Answer: Data

Explanation:

3 0
3 years ago
Select the three business advantages of globalization.
Anna007 [38]

Answer:

There is increased collaboration in problem solving.

There are increased business opportunities.

It facilitates ease in communication

4 0
3 years ago
Other questions:
  • Consider the following scenario and prescribe a solution. Situation: Tenisha is moving to Ohio to attend college. It is very hum
    15·1 answer
  • How many possible mac addresses are there?
    5·1 answer
  • 9.6 Code Practice: Question 1
    9·1 answer
  • Two good guidelines for good readability on a website are ______ (choose two)
    14·1 answer
  • Complete the function doubling_time that takes two parameters bal and apr and uses a while loop compute the number of years it t
    10·1 answer
  • How to manufacture an ict application?
    15·1 answer
  • Atoms usually combine with other atoms to form<br> A.elements<br> B.compounds <br> C.nuetrons
    5·1 answer
  • 4.In order for a driver to graduate from a learner’s license to an operator’s license, how many hours of driving need to be docu
    11·1 answer
  • What are examples of data duplication in flat files? Check all that apply.
    13·2 answers
  • To generate a series of first ten counting number of algorithm​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!