Integer userNumber is read from input. Write a while loop that multiplies userNumber by 4, updating userNumber with the product, and outputs the updated userNumber, followed by a newline. The loop iterates until userNumber is greater than or equal to 40.Ex: If the input is 25, then the output is:

100

import java.util.Scanner;

public class ProductCalculator {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int userNumber;

userNumber = scnr.nextInt();
while(userNumber >= 40){
userNumber = userNumber * 4;
System.out.println(userNumber);
}
Java. What am I doing wrong? It's not giving an output.

}
}

Answers

Answer 1
Answer:

Change this line;

  • while(userNumber >= 40)

with;

  • while(userNumber <= 40)

The loop will never start because userNumber is not already greater than 40.


Related Questions

Given the IPv4 address, 200.245.10.150/28, how many subnets are possible and how many hosts can be supported by each subnet?a. 228 = 268 subnets, 24 -2 = 14 hosts per subnetwork b. 24 = 16 subnets, 228 - 2 = 268E6 hosts per subnetwork c. 24 - 2 = 14 subnets, 24 = 16 hosts per subnetwork d. 24 = 16 subnets, 24 - 2 = 14 hosts per subnetwork
Choose the missing term-------time time.sleep(3)
Cloud storage refers to the storage of data on ______.a. your mobile device.b. your desktop computer.c. an external drive.d. a server on the Interne.
Which of the following is an example of computer hardware AppPowerPoint Web browser Microchip
What is the second stage of information processing cycle​

Which statement prints "hi" on the screen?(a) puts("hi");

(b) put "hi";

(c) puts "hi";

(d) none of the above

Answers

Answer: (A) Puts("hi");

Explanation:

 Puts() is the type function that uses the file handling in the programming language. It basically use to compose or write the function or line that displaying the output screen of the computer system.

The puts() function is the type of function which basically allow the user to read the characters or line include all the space until entering into the new character or line.

The declaration of the puts(0 function is as follows:

   int puts (char *STRING);

Answer:

a

Explanation:

___________ are used when an SQL statement has to be executed multiple times in a Python script.a

Prepared statements

b

Cursors

c

Connections

d

Queries

Answers

Answer: (A) Prepared statement

Explanation:

 Prepared statement is basically used in the structured query language (SQL) statement which are basically execute multiple times in the python script.

The prepared statement is typically used in the SQL statement for update and queries. It is used to executed for the similar SQL statement and it has high efficiency.

It basically is in the form of template where the database compile and perform various query optimization.

Suppose two hosts, A and B, are separated by 7,500 kilometers and are connected by a direct link of R = 10 Mbps. Suppose the propagation speed over the link is 2.5 x 10 8 meters/sec. Consider sending a large packet of 500,000 bits from Host A to Host B. How many milliseconds (ms) does it take before the receiver has received the entire 500,000-bit file?

Answers

Answer:

50 ms (milliseconds) will be taken in total to take the entire file by user.

Explanation:

In Computer networks, propagation delay is defined as the time in which a packet is sent from sender to receiver completely. It is computed by taking the ratio of link length and propagation speed.

We know that:

BDP(in bits) = total bandwidth (in bits/sec) * trip time(in sec)

Now according to given condition we have:

Bandwidth = R = 10 Mbps = 10,000,000 bps

BDP = 500,000 bits

For finding Propagation Delay:

Propagation Delay = BDP/ R

Propagation Delay = 500,000/10,000,000 sec

Propagation Delay = 0.05 sec

Converting in milliseconds:

Propagation Delay = 50 ms

Hence. the delay would be 0.05 seconds and in milliseconds they will be equal to 50 ms

Interchanges of ideas in forums and internet news groups are functions of which domain?

Answers

I believe that the answer to the question provided above is that the  Interchanges of ideas in forums and internet news groups are functions of the information domain.
Hope my answer would be a great help for you.    If you have more questions feel free to ask here at Brainly.

In the Stop-and-Wait flow-control protocol, what best describes the sender’s (S) and receiver’s (R) respective window sizes?

Answers

Answer:

The answer is "For the stop and wait the value of S and R is equal to 1".

Explanation:

  • As we know that, the SR protocol is also known as the automatic repeat request (ARQ), this process allows the sender to sends a series of frames with window size, without waiting for the particular ACK of the recipient including with Go-Back-N ARQ.  
  • This process is  mainly used in the data link layer, which uses the sliding window method for the reliable provisioning of data frames, that's why for the SR protocol the value of S =R and S> 1.

How many rules are contained in the css code?
a.1
b.2
c.3
d.4​

Answers

I strongly agree that B is the answer