创建一个List泛型集合,求集合中最大值、最小值、元素总和。(用控制台应用程序设计)
2条回答 默认 最新
threenewbee 2023-11-20 00:55关注using System; using System.Linq; using System.Collections.Generic; class Program { public static void Main(string[] args) { var list = new List<int>() { 1, 7, 2, 3, 6, 9 }; Console.WriteLine($"最大值{list.Max()},最小值{list.Min()},元素总和{list.Sum()}"); } }本回答被题主选为最佳回答 , 对您是否有帮助呢?评论 打赏 举报解决 2无用