C#:求三个整数的最大值

任务描述

本关任务:编写一个程序,实现从键盘输入的三个整数,输出三个整数的最大值。

编程要求

根据提示,在右侧编辑器补充代码,计算并输出从键盘输入的三个数的最大值。

测试说明

平台会对你编写的代码进行测试:

测试输入:

4

91

7

预期输出:

最大值:91

测试输入:

151

100

75

预期输出:

最大值:151

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace ch403

{

class Program

{

static void Main(string\[\] args)

{

/******begin*******/

int a = int.Parse(Console.ReadLine());

int b = int.Parse(Console.ReadLine());

int c = int.Parse(Console.ReadLine());

if(b>a){

int max = b;

b = a;

a = max;

}

if(b>c){

int max = b;

b = c;

c = max;

}

if(a>c){

int max = a;

a = c;

c = max;

}

Console.WriteLine("最大值:{0}",+c);

/*******end********/

}

}

}

相关推荐
点心的游戏开发世界4 小时前
GDScript 入门笔记(十一):Lambda 与匿名函数
开发语言·笔记·游戏引擎·godot
事圆则缓6 小时前
Kotlin 协程完全指南
开发语言·kotlin
我爱写代码i6 小时前
BeLink - 支持生成多种URL 缩短网址PHP源码
开发语言·php·短网址php源码
Java后端的Ai之路6 小时前
20、Python - 备忘录模式
开发语言·人工智能·python·外观模式·备忘录模式
统计学小王子7 小时前
数学建模国赛倒计时4天——《统计模型精讲(混合效应模型R语言实现)》
开发语言·数学建模·r语言
知无不研7 小时前
c语言中循环的介绍与简单应用
c语言·开发语言·算法·循环·for·while
郝学胜-神的一滴7 小时前
Qt 高级编程 045:坐标体系深度实战
开发语言·c++·windows·python·qt·程序人生
dsyyyyy11018 小时前
JS复习,难点,易错点总结
开发语言·javascript·ecmascript
唐青枫8 小时前
别把日志、权限写进业务方法:C#.NET 动态代理从原理到实战
c#·.net
“AI国潮设计-小江”9 小时前
Python实战 | SDXL精准控制“普宁英歌舞×星空蛋糕”IP落地,附核心Prompt与商用授权思路
开发语言·人工智能·python·prompt·aigc