题目描述
输入三个数,输出最大数,最小数
输入格式输入一行,包含三个整数a, b , c (1≤a,b,c≤1000000)
输出格式输出两行,第一行输出最大数,第二行输出最小数。具体格式见样例输出。
样例样例输入
1 2 3
样例输出
The maximum number is : 3
The minimum number is : 1
数据范围与提示
分类标签
[语法基础]
C++题解代码
#include <bits/stdc++.h>
using namespace std;
int a;
int b;
int c;
int d;
int x;
// The main procedure
int main() {
cin>>a;
cin>>b;
cin>>c;
x = 1000001;
d = 0;
if (a > d) {
d = a;
}
if (b > d) {
d = b;
}
if (c > d) {
d = c;
}
if (a < x) {
x = a;
}
if (b < x) {
x = b;
}
if (c < x) {
x = c;
}
cout<<"The maximum number is : ";
cout<<d;
cout<<'\n';
cout<<"The minimum number is : ";
cout<<x;
return 0;
}
Blockly题解代码图片