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
For each problem listed below, use the drop-down menu to select the field of the professional who can help solve the issue.
Paul [167]

Answer:

  • Interactive media
  • Information services and support
  • Programming and software development
  • Network systems administration

Explanation:

The company has finished designing a software program, but users aren’t sure how to use it. <u>interactive media</u>

Several people in the human resources department need new software installed. <u>information services and support</u>

An employee has an idea for a software program that can save the company time, but doesn’t know how to write it. <u> programming and software development</u>

A new branch of the company is opening soon, and the computers there need to be connected to the Internet. <u>network systems administration</u>

<u>OAmalOHopeO</u>

3 0
2 years ago
What type of network is the Internet? The Internet is an example of a_____network.
7nadin3 [17]

The Internet is an example of a WAN: Wide Area Network

5 0
3 years ago
30% of the mass of an objects is 24 kilograms. use this fact to find:
Triss [41]

Answer:

chemați. mfvd5. fn. cfcfcfcfcfcfcf 4t

6 0
2 years ago
What is a cell address in xsl sheet
fgiga [73]

Answer:

cell address is the exact location of a particular cell of ms-excle

Explanation:

A1 refers to first row and first column.

A2 refers to second row first column.

i.e.

in 'A1' : 'A' indicate column { A= first column, B= second

column, C= third column. and soon.....}

'1' indicate row { 1 = first row, 2 = second row, 3= third row..... soon .......}

5 0
2 years ago
C Programming:
natita [175]
This is how to answer this programming question:

#include <stdio.h>
#include <conio.h>

int main(void)
{
   char letterStart;
   
   <span>fflush(stdin);</span>
   printf("Input character: ");
   scanf("%c", &letterStart);
   
   print("Next Letter: %c", ++letterStart);
   
   getch();
   clrscr();
}

7 0
3 years ago
Read 2 more answers
Other questions:
  • You have to communicate a signal in a language that has 3 symbols A, B and C. The probability of observing A is 50% while that o
    11·1 answer
  • What operator is used to create a validation rule? A. – B. / C. &lt; or &gt; D. +
    12·1 answer
  • HELP AS SOON IS A UNIT TEST WILL GIVE BRAINLIEST
    9·2 answers
  • What encryption method is used by WPA for wireless networks?
    7·1 answer
  • A USB zipper drive is a small data storage device that plugs into a computer's USB port.
    14·1 answer
  • write a program in C# that reads a set of integers and then finds and prints the sum of the even and odd integers?​
    12·1 answer
  • You need to replace a broken monitor on a desktop system. You decide to replace it with a spare monitor that wasn't being used.
    15·2 answers
  • Your program will be used by many departments at the university. Your comments will be important to their IT people. What would
    13·1 answer
  • When adding a component to a container with the ____ layout, specify the NORTH, EAST, SOUTH, WEST, or CENTER position.
    8·1 answer
  • Ali has created a small program in Python, but he wants to store his data in a multi-dimensional array. He would like to use adv
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!