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]
3 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]3 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
WIN
Delicious77 [7]
The correct answer is D
6 0
3 years ago
Read 2 more answers
Displays information a bout drivers, network connections, and other program-related details.
slava [35]

Answer:

library

Explanation:

hope you like it

6 0
3 years ago
(asking again because point-hogs exist)
yawa3891 [41]

The answer is 2-to-the-power-of-n, since for every input, the number of different combinations doubles. From your list I think answer A is meant to indicate 2ⁿ.

6 0
2 years ago
Linguist study_____
-Dominant- [34]
That's B.

Linguist love all kinds of studies of languages culture writing etc.
6 0
3 years ago
If you like to play graphic-intensive games on your computer and you find that your computer can't keep up, you should add a ___
s344n2d4d5 [400]
I think its video card tell me if i'm wrong
6 0
3 years ago
Other questions:
  • A tool that is used to search for and gather data from a page on the internet is called a ?
    11·2 answers
  • Gina's teacher has sent her a Word document that contains the names of all the students who are participating in the
    11·2 answers
  • Advancement in technology is making peripherals...
    5·2 answers
  • Two technicians are discussing shielded cable. Technician A says that shielded wires are generally twisted in pairs to cancel th
    14·1 answer
  • The most widely used presentation software program is Microsoft PowerPoint. You can produce a professional and memorable present
    8·1 answer
  • Write a function called intersect with four float parameter
    11·1 answer
  • While working alone at their constant rates computer X can process 240 files in 4 hours, and comp Y 240 files in 8 hrs. If all f
    6·2 answers
  • Network address 192.10.10.0<br>​
    12·1 answer
  • What is one advantage of hard-disk recording?
    12·1 answer
  • Write a program to enter RADIUS of a CIRCLE and PRINT AREA of TRIANGLE using Q Basic. (class 8)​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!