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
If you're doing a relational comparison, which filter would be available?
taurus [48]

Answer:

C. Number

Explanation:

If you're doing a relational comparison, a number filter would be available.

7 0
3 years ago
10. Differentiate between equity share &amp; preference share.​
IrinaVladis [17]

Answer:

Equity Shares are commonly called Common shares and have both advantages and disadvantages over Preference shares.

  • Equity shareholders are allowed to vote on company issues while preference shareholders can not.
  • Preference shareholders get paid first between the two in the case that the company liquidates from bankruptcy.
  • Preference shareholders get a fixed dividend that has to be paid before equity share dividends are paid.
  • Preference shareholders can convert their shares to Equity shares but equity shareholders do not have the same courtesy.
  • Preference shares can only be sold back to the company while equity shares can be sold to anybody.

5 0
2 years ago
PLEASE HELP!! Computer science test
tatiyna

Answer:

See Explanation

Explanation:

Given

The attached function

What the recursion does is that; it adds up individual digits from N to 0

Solving (a): Each output when N = 6

For N = 6.

The function returns the following values:

f(6) = 6

Then: 6 + f(5)

Then: 6 + 5 + f(4)

Then: 6 + 5 + 4 + f(3)

Then: 6 + 5 + 4 + 3 + f(2)

Then: 6 + 5 + 4 + 3 + 2 + f(1)

Then: 6 + 5 + 4 + 3 + 2 + 1 + f(0)

Then: 6 + 5 + 4 + 3 + 2 + 1 + 0 = 21

Solving (b): The output when N = 7

Using the same process in (a) above.

The output is 28

6 0
3 years ago
What are TWO examples of soft skills?
Elanso [62]
Computer programming and throubleshooting
3 0
3 years ago
The application layer in the tcp/ip protocol suite is usually considered to be the combination of ________ layers in the osi mod
navik [9.2K]
Application Presentation and Session Layers.
8 0
3 years ago
Other questions:
  • _ includes websites that encourage interaction and connection among people, businesses, and organizations.
    5·1 answer
  • How do you delete text from a slide
    14·2 answers
  • Pls answer fast in five mins​
    12·1 answer
  • What are the four types of technical drawing?​
    9·1 answer
  • Match the item to the type.
    11·1 answer
  • Two Technicians are discussing ShopKey Pro. Technician
    14·1 answer
  • Please help!
    10·2 answers
  • What are the five Ws?<br> (I don’t even know what this means)
    5·2 answers
  • The ratio of sparrows to bluejays at the bird sanctuary was 5 to 3 If there were 15 bluejays in the sanctuary, how many sparrows
    12·1 answer
  • A timer is set after each frame is sent before waiting an ACK for that frame, how long does the timer take to be expired?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!