a. Write a Java program to input 10 integer numbers into an array named fmax and determine the maximum value entered. Your program should contain only one loop, and the maximum should be determined as array element values are being input. (Hint: Set the maximum equal to the first array element, which should be input before the loop used to input the remaining array values.)

b. Repeat Exercise a, keeping track of both the maximum element in the array and the index number for the maximum. After displaying the numbers, display these two messages:

            The maximum value is: ________

            This is element number ________ in the list of numbers

Have your program display the correct values in place of the underlines in the messages.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *