显示数组中的最大数
原创
©著作权归作者所有:来自51CTO博客作者刘文斌3313的原创作品,谢绝转载,否则将追究法律责任
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "";
int[] shuju = { 32, 23, 16, 78, 5, 19, 41 };
for (int i = 0; i < shuju.Length; i++)
{
Label1.Text += shuju[i] + " ";
}
}
protected void Button2_Click(object sender, EventArgs e)
{
int[] shuju = { 32, 23, 16, 78, 5, 19, 41 };
int max = 0;
for (int i = 1; i < shuju.Length; i++)
{
if (shuju[i] < shuju[i - 1])
{
max = shuju[i - 1];
shuju[i - 1] = shuju[i];
shuju[i] = max;
}
Label2.Text = "最大的数是:"+max.ToString();
}
}
下一篇:×××中奖号码查询
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Java 中数组的使用(一维数组和二维数组)
本文详细的介绍了,在Java 中数组的使用,并对其内存存在形式进行了详细的分析。
数组 一维数组 二维数组 java基础 -
寻找最大数
个很大的整数,但其位数不超过100位,并
namespace cstring strlen c 算法