/*目的:练习找出数组中最大的一个数
*知识点:函数
*作者:beeone
*日期:2011-02-19
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int[] ArryText = { 12,1, 5, 2, 9, 15, 98, 44, 100, 33, 654,0 ,-1};
Console.WriteLine("最大的数是:"+GetMaxNum(ArryText));
Console.ReadKey();
}
static int GetMaxNum(int[] Myarry)
{
int NUM = Myarry[0];
for (int i = 0; i < Myarry.Length; i++)
{
if (Myarry[i] >NUM)
{
NUM = Myarry[i];
}
}
return NUM;
}
}
}
![](https://img2024.cnblogs.com/blog/35695/202408/35695-20240826070647288-243310440.jpg)