写出对任意个输入N个整数找出中位数的C语言程序,着急快帮小弟我写个

写出对任意个输入N个整数找出中位数的C语言程序,着急啊,快帮我写个
写出对任意个输入N个整数找出中位数的C语言程序,着急啊,快帮我写个

------解决方案--------------------
好吧,加上排序的写出对任意个输入N个整数找出中位数的C语言程序,着急快帮小弟我写个

void sort(int *a,int count)
{
int temp;
for(int i=0;i<count-1;i++)
{
for(int j=i+1;j<count;j++)
{
if(*(a+i)>*(a+j))
{
temp=*(a+i);
*(a+i)=*(a+j);
*(a+j)=temp;
}
}
}
}
int main()
{
int *a;
int count,mid;
printf("请输入你要输入的数的个数\n");
scanf("%d",&count);
a=(int *)malloc(sizeof(int)*count);
if(count%2!=0)
mid=(count+1)/2-1;
else
mid=count/2-1;
printf("请输入%d个数字\n",count);
for(int i=0;i<count;i++)
{
scanf("%d",a+i);
}
sort(a,count);
printf("中位数为%d\n",*(a+mid));
free(a);
a=NULL;

return 0;
}