C Calculer la médiane
//function that receives an array and it's number of elements as ints
//and outputs the array's median value as a float
float CalcMedian(int ar[], int arraySize)
{
float median;
if(arraySize % 2 == 0){
//2.0 needs the decimal value so it doesn't truncate the result
median = (ar[(arraySize-1) / 2] + ar[arraySize/2]) / 2.0;
}else{
median = ar[arraySize/2];
}
return median;
}
AngryPea