Find the median
Submissions: 5415   Accuracy:

31.8%

  Difficulty: School   Marks: 0
*School Problem's Submission isn't counted in score!

Given the marks of all students, calculate the median.

Input:
The first line of input takes the number of test cases, T. For each test case there will be two lines. The first line contains an integer N denoting the number of students, and second line contains N space seperated integers which denotes the marks of N students.

Output:
Print the floor value of the median for each test case on a new line.

Constraints:
1 <= T <= 100

1 <= N <= 100
1 <= Marks <= 100

Example:
Input:

3
4
56 67 30 79
4
78 89 67 76
5
90 100 78 89 67

Output:
61
77
89

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Arpan Kundu
Author: akundusaltlake


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.