Question
Write a program that can read a list of numbers, find their average, sort the numbers, and search the average. The detailed tasks are described
Write a program that can read a list of numbers, find their average, sort the numbers, and search the average. The detailed tasks are described below. 1) Write a function named EvenOrOdd, which inspects the argument and returns an integer value. If the argument is even, the function returns 0; if odd, returns 1. 2) Write a function named ArrayAverage, which returns the average of an array. 3) Read 6 integers from the users input and store them in an array named numbers. Display the array elements (in the original order). 4) Declare an integer variable named avg. Call the function ArrayAverage to compute the average of the elements in the array numbers, and assign it to avg. 5) If avg is even, do the bubble sorting; if odd, do the selection sorting. In both cases, sort the array to an ascending order. Display the sorted array elements on the screen. 6) Apply the binary searching to find whether avg is in the array numbers. Display the searching result on the screen.
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