C#求n个数中最大值和最小值的方法

这篇文章主要介绍了C#求n个数中最大值和最小值的方法,涉及C#中max及min方法的使用技巧,需要的朋友可以参考下

本文实例讲述了C#求n个数中最大值和最小值的方法。分享给大家供大家参考。具体实现方法如下:

 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { Console.WriteLine("输入十个数: "); // int [] num = new int[10]; //for (int i = 0; i <10; i++) //{ string s = Console.ReadLine(); // num[i] = int.Parse(s); // } string[] num = s.Split(' '); //把空格挖掉,把数存入数组 int[] m = new int[num.Length]; for (int i = 0; i 

希望本文所述对大家的C#程序设计有所帮助。

以上就是C#求n个数中最大值和最小值的方法的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » 其他教程