C program to calculate median of an array
Basically a median is the value present at the centre of a sorted array list. To calculate the median first we need to sort the list in ascending or descending order.
If the number of elements are even, then the median will the average of two numbers in the middle.
But the number is odd then the middle element of the array after sorting will be considered as the median.
Given N elements of integer array and we have to find its median in C.
Example:
Input:
Array elements are:
3, 2, 1, 4, 6
Sorted array is:
1, 2, 3, 4, 6
Output:
The median is : 3.000000
Program to find median of an array in C
Output
need an explanation for this answer? contact us directly to get an explanation for this answer