比大小【……】
链接:https://ac.nowcoder.com/acm/problem/22015
来源:牛客网
时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 32768K,其他语言65536K
64bit IO Format: %lld
空间限制:C/C++ 32768K,其他语言65536K
64bit IO Format: %lld
题目描述
输入三个数,输出最大数,最小数
输入描述:
输入一行,包含三个整数a, b , c (1≤a,b,c≤1000000
示例1
输出
#include<iostream>
using namespace std;
int main()
{
int a[3];
int max = 1;
int min = a[0];
for(int i = 0;i < 3;i++)
cin>>a[i];
for(int i = 0;i < 3;i++)
{
if(max < a[i])
max = a[i];
}
cout<<"The maximum number is :"<<" "<<max<<endl;
for(int i = 0;i < 3;i++)
{
if(min > a[i])
min = a[i];
cout<<min<<endl;
}
cout<<"The minimum number is :"<<" "<<min;
return 0;
}
复制
The maximum number is : 3 The minimum number is : 1
赖大猪加油

浙公网安备 33010602011771号