namespace ConsoleMatrix { class Program { static void Main(string[] args) { int x, max = int.MinValue; Console.WriteLine("请输入3个数:"); for (int i = 0; i < 3; i++) { x = int.Parse(Console.ReadLine()); if (x > max) max = x; } Console.WriteLine("最大数为:{0}", max); } } }
int x, y, z, max, t; x = int.Parse(Console.ReadLine()); y = int.Parse(Console.ReadLine()); z = int.Parse(Console.ReadLine()); t = Math.Max(x, y); max = Math.Max(t, z);