static void Main(string[] args)
{
int[] num1 = { 1, 3 };
int[] num2 = { 2 ,4};
List<int> lis = new List<int>();
lis.AddRange(num1);
lis.AddRange(num2);
int[] num3 = lis.ToArray();
Array.Sort(num3);
double med;
int len = num3.Length;
if (len % 2 == 0)
med = (num3[len / 2] + num3[len / 2 - 1]) / 2d;
else
med = num3[len / 2];
Console.WriteLine(med);
}
11-27
268
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-04
3万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
09-14
2162
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-24
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交