You are given an array x of int elements along with an int variable n that conta
ID: 3653822 • Letter: Y
Question
You are given an array x of int elements along with an int variable n that contains the number of elements in the array. There are no duplicates in this array. You are also given an int variable m that has been declared. Assign to m the median value of the array. NOTE: The median of a set of numbers is the number in the set such that there are as many numbers above that value as there are below. If the set has an even number of members, the median is the average of the pair of numbers such that there are as many numbers above the pair as there are below. EXAMPLE 1: Given 5 8 1 9 7 the median is 7 because there are two numbers below (1 5) and two numbers above (8 9). EXAMPLE 2: Given 3 7 1 4 6 9 the median is the average of 4 and 6 because there are two numbers above 4 and 6 (7 9) and two numbers below (3 1). plz helpExplanation / Answer
Hi, my friend here is the program u want if u need more help message me PLEASE RATE Note: that n=10 we ask the user to enter the numbers u can change either of them #include #include using namespace std; int median(int nums[],int n) { if(n%2==0) { return ( ( nums[n/2]+nums[n/2 +1]) /2 ); } else { return (nums[n/2]); } } int main() { int nums[10]; int n=10; for(int i=0;i>nums[i]; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.