Unity - A计划(永久有效期) 扫二维码继续学习 二维码时效为半小时

(196评价)
价格: 4059.00元
C#编程第一季 任务39 10:00左右 比较三个数字大小,并取最大数的值的平方输出
是巧克力呀发起了问答2022-08-12
3
回复
123
浏览

//最⼤值:输⼊三个整数,求这个三个数中最⼤值的平⽅

            int a = Convert.ToInt32(Console.ReadLine());
            int b = Convert.ToInt32(Console.ReadLine());
            int c = Convert.ToInt32(Console.ReadLine());
            int max = a;
            if (b > max)
            {
                max = b;
            }
            if (c > max)
            {
                max = c;
            }
            Console.WriteLine(c * c);

按照教程输出,不管怎么样,只会输出最后一组数据的平方。

老师代码如图:

 

所有回复
发表回复
你还没有登录,请先 登录或 注册!