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********/

}

}

}

相关推荐
何以解忧唯有撸码6 小时前
c# + YOLODotNet+OpenCVSharp 实现物品轨迹追踪
计算机视觉·c#·winform·yolov8·opencvsharp
学逆向的7 小时前
C 堆区内存管理
c语言·开发语言·网络安全
huoyueyi8 小时前
《融天AI-APP从0到1开发实录》
开发语言·lua
OpenAnolis小助手9 小时前
PHP 两个严重漏洞曝光,龙蜥社区 24 小时完成 3 版本修复
开发语言·操作系统·php·龙蜥社区
阿尼卡~10 小时前
VS Code 配置 C 语言开发环境(Windows 10/11):从 GCC 安装到运行、断点调试,一篇搞定
c语言·开发语言·windows
hhhjhl11 小时前
Undici 跨端三方库仓颉适配全流程
java·开发语言·ubuntu
染指111011 小时前
158.Agent-LangGraph-子图(共享状态和不共享状态模式)
开发语言·人工智能·python·ui·agent·agents
wangchunyu11411 小时前
JAVA JVM内存结构与运行时数据区
java·开发语言·jvm
slongzhang_11 小时前
linux 递归删除源码文件|递归删除目录下 *.js,但排除 *.min.js
linux·开发语言·javascript
云和数据.ChenGuang13 小时前
Python 常见特殊方法详解:__new__、__init__、__del__、__str__、__repr__ 与 __getattribute__
开发语言·人工智能·python·1024程序员节