Answer: Provided in the explanation section
Step-by-step explanation:
#include <stdio.h>
double median(double array[] , int n)
{
double med;
//if n is even then return average of middle of two element.
if(n%2==0)
med = ( array[(n-1)/2] + array[n/2] ) /2.0 ;
else
med = array[n/2];//if n is odd return middle element.
return (med);
}
int main()
{
double array[6] = {1.3,3.5,5,7.7,9.0,11};
//size store size of array.
int size=sizeof(array)/sizeof(double);
//call the median function.
double medvalue =median(array, size);
printf("median is : %lf\\",medvalue);
return 0;
}
//OUTPUT : median is : 6.350000
⇒ Provided is the Image of the code and output.
cheers i hope this helped !!