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 should be included in research for a problem statement? Select all that apply
Burka [1]

Answer:

I think the answer is C and D

7 0
3 years ago
Read 2 more answers
Explain the need for data structures when developing software.
Sergio [31]

Solution:

It is  important because, it has to do operation on so without, data structures and algorithms.

It performs these operation:  

 1)Take an input

2) Process it  

3) Give back the output.

The input can be in any form, for ex while searching for directions on google maps,  the starting point and the destination as input to google maps, while logging in to any social sites, We have to give our email and password as input and so on.

Similarly, in the third step, the computer application gives us output in some form or the other.

To make this process efficient, we need to optimize all the three steps.

4 0
3 years ago
when a picture is downloaded off the internet and then posted to social media, can the social media platform tell it was downloa
Nataly_w [17]
Short answer yes. kinda long answer people can scan the photo and easily see or they can just look up the same image
4 0
3 years ago
Determine the exact output of the code:
stiv31 [10]

Answer:

3

Explanation:

The function floor() is used to give the integer which is smaller than or equal to the provided decimal value.

for example:

let a=5.8

floor(a);

the function provides the value 5 (smaller than or equal to 5.8).

In the given code:

variable num assigns the number 3.14.

then, floor(3.14) gives the value 3 (smaller than or equal to 3.14).

then, the echo print the value on the screen.

Therefore, the correct answer is 3.

4 0
3 years ago
A disk with many program and data files scattered on it is said to be ____.
Airida [17]
Fragmented would be the answer
5 0
3 years ago
Other questions:
  • Write the following function without using the C++ string class or any functions in the standard library, including strlen(). Yo
    12·1 answer
  • Which of the following are examples of software? Check all of the boxes that apply.
    12·2 answers
  • What should a safe username do?
    14·2 answers
  • Write an application that determines the value of the coins in a jar and prints the total in dollars and cents. Read integer val
    6·2 answers
  • The default paper size is _____. <br> a. letter <br> b. legal <br> c. executive <br> d. statement
    7·1 answer
  • When classified data is sent over an unclassified network, what is this incident called?
    5·1 answer
  • How do you close a file?
    12·2 answers
  • The ______________ shows that you have fully researched the topic and gives you a chance to prove your claim.
    8·1 answer
  • ¿ El Parque Fray y Jorge es un patrimonio Cultural/Natural o patrimonial de Chile ?
    14·1 answer
  • Select the WRONG statement about Slide Transitions.
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!