Question: Declare a Boolean variable named allValid. Then, read integer numVals from input representing the number of integers to be read next. Use a loop to
Declare a Boolean variable named allValid. Then, read integer numVals from input representing the number of integers to be read next. Use a loop to read the remaining integers from input. If all of the numVals integers are in the range to inclusive, assign allValid with true. Otherwise, assign allValid with false.
Code at the end of main outputs "All valid" if allValid is true or "Has nonmatching values if allValid is false.
Ex: If the input is:
then the output is:
Has nonmatching valuesC
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
