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.
}
}