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
What happened to motion pictures when television became popular?
Sphinxa [80]
They became more popular and more advanced with their pictures
5 0
3 years ago
Jane sold many notebooks at her school fair and earned a good amount of cash. To keep a record, she entered all the cash values
pantera1 [17]
Use tab key & shift+$
6 0
3 years ago
Variables defined inside a member function of a class have: Block scope. Class or block scope, depending on whether the binary s
Snowcat [4.5K]

Answer:

The answer is "Block scope".

Explanation:

In the programming, the scope is a code, in which it provides the variable ability to exist and not be retrieved beyond variable. In this, the variables could be defined in 3 locations, that can be described as follows:

  • Inside a method or the block, which is also known as a local variable.
  • Outside of the method scope, which is also known as a global variable.
  • Defining parameters for functions known as formal parameters.
8 0
3 years ago
I just downloaded this song and if any one wants to listen to it then go ahead and do that. It’s called Trap Music 2018 âa bass
xz_007 [3.2K]

Answer:

ok

Explanation:

4 0
3 years ago
Read 2 more answers
What is the correct sequence of the phases in the systems development life cycle?
HACTEHA [7]
1. Requirements gathering/analysis.
2. Design.
3. Development.
4. Testing.
5. Maintenance.
7 0
3 years ago
Other questions:
  • Skinner designed a soundproof apparatus, often equipped with a lever or bar, with which he conducted his experiments in operant
    9·1 answer
  • Often used in connection with a business
    6·1 answer
  • Identify the primary responsibilities associated with each of the following web design roles: content writer/editor, artist/grap
    13·1 answer
  • What is a correlation and how does it relate to inferential error?
    5·1 answer
  • to edit text boxes in a template, first A click on the text box you want to edit B begin typing C format the front D drag the te
    5·2 answers
  • To check spelling errors in a document, the Word application uses the _____ to determine appropriate spelling.
    7·2 answers
  • Which software application offers a variety of templates for creating reports, flyers, and newsletters that you can access withi
    12·1 answer
  • I dont understand this at all! PLZ help me
    14·1 answer
  • IN WHICH COUNTRY DO THEY LET YOU PLAY MINECRAFT IN SCHOOL?
    8·2 answers
  • #done with school already
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!