TestCases are not Passing

I AM GETTING OUTPUT FOR SAMPLE TESTCASES BUT TESTCASES ARE NOT PASSING

HERE IS MY CODE : https://ide.codingblocks.com/s/262295

is there anyone to reply

the error is at line no 51
if(x < med)

correct one is
if (x > med)

second problem is you are print ans with double values
means you are printing in decimal values as well
but you have to print intergers only

MOdified Code

i hope this help
if you have more doubts regarding this feel free to ask
if your doubt is resolved mark it as resolved from your doubt section inside your course