using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace ConsoleApplication1
{class Program{/** 不断的输入数字,知道输入end,输出最大值*/static void Main(string[] args){int max = 0;while(true) {Console.WriteLine("请输入数字:");string number = Console.ReadLine();if("end" == number){Console.WriteLine("{0}", max);Console.ReadKey();return;}int numberInt = Convert.ToInt32(number);if(numberInt > max){max = numberInt;}}Console.ReadKey();}}
}
详细解决方案
不断的输入数字,直到输入end,输出最大值
热度:18 发布时间:2024-01-17 03:42:20.0
相关解决方案