您的位置:首页 > 其它

练习找出数组中最大的一个数

2011-03-29 00:19 218 查看
/*目的:练习找出数组中最大的一个数
*知识点:函数
*作者: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;
}

}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐