c语言版
int mid(int a,int b,int c)
{
int maxnum,minnum,midnum;
maxnum=max(a,max(b,c);
minnum=min(a,min(b,c));
if(maxnum==a){
if(minnum==b)
midnum=c;
else
midnum=b;
} else if(maxnum==b){
if(minnum==a)
midnum=c;
else
midnum=a;
}else if(minnum==a)
midnum=b;
else
midnum=a;
return midnum;
}