C 程序找出三个数中最大的数
此程序获取 3 个数,并找出其中的最大值。为此,我们将相互比较这些数字,找出最大的数字
Input: a=2,b=4,c=7 Output:7 Largest Number
说明
此程序仅使用 if 语句找出最大值。
示例
#include <iostream>
using namespace std;
int main() {
int a,b,c;
a=2,b=4,c=7;
if(a>b) {
if(a>c) {
printf("%d Largest Number ",a);
} else {
printf("%d Largest Number ",c);
}
} else {
if(b>c) {
printf("%d Largest Number ",b);
} else {
printf("%d Largest Number ",c);
}
}
return 0;
}
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP