比大小【……】

链接:https://ac.nowcoder.com/acm/problem/22015
来源:牛客网

时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 32768K,其他语言65536K
64bit IO Format: %lld

题目描述

输入三个数,输出最大数,最小数

输入描述:

输入一行,包含三个整数a, b , c  (1a,b,c1000000

 

示例1

输入

复制
1 2 3

输出

#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


猜你喜欢

转载自www.cnblogs.com/likk/p/11223111.html