Question: Integer numVals is read from input and integer array student Numbers is declared with size numVals. Then, numVals integers are read from input and
Integer numVals is read from input and integer array student Numbers is declared with size numVals. Then, numVals integers are read from input and stored in studentNumbers. For each element in studentNumbers that is equal to -1, increment count. Ex: If the input is 4 - 1 2 -4 -1 then the output is: Count: 2 0 00 o u 4 5 6 7 8 9 10 11 12 13. 14 15 16 17 18 19 20 21 PAULAL VM MALJ - L Scanner scnr= new Scanner (System.in); } int numVals; int i; numVals = scnr .nextInt(); int[] studentNumbers = new int[numVals]; int count = 0; for (i = 0; i < studentNumbers.length; ++i) { studentNumbers [i] scnr.nextInt (); } /* Your code goes here */ System.out.println("Count: + count); 2 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
