Page 1 of 1

Write a Java program which reads a one-dimensional integer artay from the user. The program should calculate maximum and

Posted: Sat May 14, 2022 3:48 pm
by answerhappygod
Write A Java Program Which Reads A One Dimensional Integer Artay From The User The Program Should Calculate Maximum And 1
Write A Java Program Which Reads A One Dimensional Integer Artay From The User The Program Should Calculate Maximum And 1 (49.86 KiB) Viewed 54 times
Write a Java program which reads a one-dimensional integer artay from the user. The program should calculate maximum and minimum values among the values that is included in the array as both positive and negative. For example, for the array (-9,5, 1, 2, 3.-3.2.-4.-5} only 3.-5.-3.5 will be included in the calculation as the array does not contain negative of other values. Additionally, the average of the negative numbers in the array should be printed Sample Outputs: How many elements will you enter? 9 Enter number 1: -9 Enter number 2: 5 Enter number 3: 10 Enter number 4: 2 Enter number 5: 3 Enter number 6: -3 Enter number 7: 2 Enter number 8:4 Enter number 9: -5 Max: 5 Min: -5 Average of the negative values: -5.25 How many elements will you enter? Enter number 1: 1 Enter number 2 : 2 Enter number 3: 3 Enter number 4: 5 Enter number 5: 4 No min or max Average of the negative values: -4.5