namespace Work4
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
static void Main(string[] args)
{
int max = 0;//输出所输入数字中的最大值
while (true)
{
Console.WriteLine("请用户输入一个数");
string s = Console.ReadLine();
if (s == "end")
{
Console.WriteLine("所输入的数中的最大值为:{0}", max);
Console.ReadKey();
return;
}
int a = Convert.ToInt32(s);
if (a > max)
{
max = a;
}
}
}
}
}
本文介绍了一个使用C#编写的简单程序,该程序通过不断接收用户输入的整数并找出其中的最大值,直到用户输入end为止。

604

被折叠的 条评论
为什么被折叠?



