站点图标 陌路寒暄

输出两个整数中较小的数(2)

输出两个整数中较小的数(2)

时间: 1ms        内存:128M

描述:

输入两个整数,将其中较小那个数输出到屏幕上

输入:

两个整数

输出:

较小那个数

示例输入:

3 7

示例输出:

3

提示:

参考答案(内存最优[920]):

#include <stdio.h>
int main()
{
    int a, b,min;
       scanf("%d %d", &a, &b);
if(a>b)
min=b;
else
min=a;
       printf("%d",min);
    return 0;
}

参考答案(时间最优[0]):

#include<iostream>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(a<b)
		cout<<a<<endl;
	else
		cout<<b<<endl;
	return 0;
}

题目和答案均来自于互联网,仅供参考,如有问题请联系管理员修改或删除。

退出移动版