站点图标 陌路寒暄

求出最大值

求出最大值

时间: 1ms        内存:128M

描述:

输入3个整数,输出其中的最大值

输入:

3个整数

输出:

3个整数中的最大值

示例输入:

2 6 3

示例输出:

6

提示:

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

program p1000(Input,Output); 
var 
	a,b,c:integer;
begin 
   	read(a,b,c);
   	if a<b
   	then a := b;
   	if a<c
   	then a := c;
    write(a);
end.

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

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

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

退出移动版