Question: Integer numSuccesses is initialized with 0 . Input consists of integers that are raw data of an experiment. Write a while loop that iterates until
Integer numSuccesses is initialized with Input consists of integers that are raw data of an experiment. Write a while loop that iterates until numSuccesses is equal to In each iteration of the loop:
Read integer currDepth from input.
If currDepth is between and both inclusive, then increment numSuccesses and output currDepth followed by a newline.
Click here for example
Note: Assume that input has at least three integers.
import java.util.Scanner;
public class SimpleWhileLoop
public static void mainString args
Scanner scnr new ScannerSystemin;
int currDepth;
int numSuccesses;
numSuccesses ;
while numSuccesses
currDepth scnrnextInt;
if currDepth && currDepth
numSuccesses;
System.out.printlncurrDepth;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
