C 语言实例 - 判断三个数中的最大数

C 语言教程 · 2019-02-20 16:56:36

通过屏幕我们输入三个数字,并找出最大的数。

实例

#include <stdio.h> int main() { double n1, n2, n3; printf("请输入三个数,以空格分隔: "); scanf("%lf %lf %lf", &n1, &n2, &n3); if( n1>=n2 && n1>=n3 ) printf("%.2f 是最大数。", n1); if( n2>=n1 && n2>=n3 ) printf("%.2f 是最大数。", n2); if( n3>=n1 && n3>=n2 ) printf("%.2f 是最大数。", n3); return 0; }

运行结果:

请输入三个数,以空格分隔: 1 2 3
3.00 是最大数。

点击查看所有 C 语言教程 文章: https://codercto.com/courses/l/17.html

查看所有标签

Uberland

Uberland

Alex Rosenblat / University of California Press / 2018-11-19 / GBP 21.00

Silicon Valley technology is transforming the way we work, and Uber is leading the charge. An American startup that promised to deliver entrepreneurship for the masses through its technology, Uber ins......一起来看看 《Uberland》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换