c#语言编程的问题求解

c#编程:随机输入21个整数,将它们按从小到大顺序排列输出,并求出中间三个数之和

using System;
using System.Linq;

public class Test
{
    public static void Main()
    {
        // your code goes here
        int[] arr = new int[21];
        Random rnd = new Random();
        for (int i = 0; i < 21; i++)
            arr[i] = rnd.Next(0, 100);
arr = arr.OrderBy(x => x).ToArray();
        Console.WriteLine("{0}", arr[9] + arr[10] + arr[11] );
    }
}

问题解决的话,请点我回答左上角的采纳和向上箭头