Question
Can someone help me with this program, please? Declare an array to hold 8 integers. Use a for loop to add 8 random integers, all
Can someone help me with this program, please? Declare an array to hold 8 integers. Use a for loop to add 8 random integers, all in the range from 50 to 100, inclusive, to this array. (Dups are ok.) Next, pass the array to a method that sorts the array and returns another array containing only the largest and smallest elements in the original array. Print these 2 values in Main. Then use a foreach loop to display all elements of the sorted array on one line separated by a single space. This latter loop should also count the odd and even numbers in the array and determine the sum of all elements in the array. Sample Output: The lowest element is 59 (next line) The highest element is 96 (next line) Here is the array (next line) 59 64 76 77 80 88 91 96 (next line) Evens: 5, odds: 3 (next line) Total: 631
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started