Write a Java program which reads a one-dimensional integer artay from the user. The program should calculate maximum and
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Write a Java program which reads a one-dimensional integer artay from the user. The program should calculate maximum and
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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!