日期:2014-05-17 浏览次数:20470 次
System.Random rnd = new System.Random(); IEnumerable<int> numbers = Enumerable.Range(0, 10).OrderBy(r => rnd.Next()).Take(3); List<int> nums = numbers.ToList(); nums.ForEach(I => Response.Write(I.ToString() + "<br/>")); if (nums.Sum().ToString().Length == 1) { Response.Write("00" + nums.Sum().ToString()); } else if (nums.Sum().ToString().Length == 2) { Response.Write("0" + nums.Sum().ToString()); } else { Response.Write(nums.Sum().ToString()); }