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
Suppose you joined a company that had a WAN composed of SONET, T carrier, and frame relay services, each selected to match a spe
wariber [46]

Answer:

Colts, gan 8 This depends on depends on How suitable the varbus technolog. A axe fol the Applicationd Supporlds Today, increasingly Network...

6 0
3 years ago
You have posted some embarrassing photos of a friend onto the Internet. After
e-lub [12.9K]

Answer:

C

Explanation:

4 0
3 years ago
The largest type of computer system with the most extensive storage capacity and the fastest processing speeds is a ________.
azamat
Super Computer. Hope I helped.
5 0
3 years ago
What are the 5 font/typography families
larisa [96]

Answer:

Arial

Helvetica

Verdana

Calibri

Noto

Explanation:

8 0
3 years ago
(in python)Write a program that takes a date as input and outputs the date's season. The input is a string to represent the mont
alexgriva [62]

Answer:

free points boi

Explanation:

3 0
3 years ago
Other questions:
  • Suppose you find a magic $1.00 coin. Its magic power is as follows: as each day passes, you get an additional dollar plus half o
    6·1 answer
  • Lief wants to keep the information of his chart, but he doesn’t want it taking up space in his page. What should he select after
    7·2 answers
  • If you have cable internet service, what protocol is used between the head end connection and the cable company's network
    8·1 answer
  • 1. The Percentage of T9 and T10 also have the wrong number format. Change them to the Correct number format(to match the rest of
    13·1 answer
  • Print 'userNum1 is negative" if userNum1 is less than 0. End with newline Convert userNum2 to 0 if userNum2 is greater than 9. O
    8·1 answer
  • Discuss how the Database models effected the business processes and the impact of using the different database models on the bus
    6·1 answer
  • You have been using the same computer for several years. To extend its service life, you decide to upgrade the processor. You ch
    12·1 answer
  • A medium format camera has a large image sensor what benefit will a large sensor have for resulting images. PICK MORE THAN ONE.
    7·1 answer
  • Which of the following is a type of savings vehicle? A.Certificate of Deposit
    8·1 answer
  • No careers combine more than one value
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!