Test

sdfsdf

 

 

static void Main(string[] args)
        {
           int[] list = new int[1001];
           for (int i = 1; i < 1001; i++)
          {
                list[i - 1] = i;
           }

            Random random = new Random();
            list[1000] = random.Next(1, 1000);
            int sum1 = 0;
            int sum2 = 0;
            foreach (int i in list)
           {
               sum1 = sum1 + i;
            }
           for (int i = 1; i < 1001; i++)
            {
               sum2 = sum2 + i;
            }

          Console.WriteLine("重复的数字是:"+(sum1 - sum2).ToString());
            Console.Read();
        }

 

 

posted @ 2013-07-14 16:22  WingWing111  阅读(111)  评论(0编辑  收藏  举报