
3个回答
展开全部
using System;
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);
使用Math类中的Max方法,可以不用循环实现
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);
使用Math类中的Max方法,可以不用循环实现
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用Math.Max(byte val1,byte val2)进行两次对比
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询