The array is sorted correctly. My issue is I'm receiving errors in the median calculation. In some examples it is mentioned that there is an issue with the elements of the array being initialized as a double with regards to % operator and needs to be cast as an int. I tried re-casting my element variable num_elements to int, which silenced the error in the if condition, but had no effect on the calculations involving the array elements. I also read about there being an issue with the array subscripts, but re-casting the array doesn't eliminate the error's either. I'm confused as to why this is not an issue in the sorting for loop, but when I try to calculate the median it is?