游客 Signup | Login
中文 | En

1406 - C语言-最大值

编写一个程序,输入a、b、c三个值,输出其中最大值。

Input

一行数组,分别为a b c

Output

a b c其中最大的数

Examples

Input

10 20 30

Output

30

Solution C

#include<stdio.h>
int main()
{
	int a,b,c,max;
	scanf("%d%d%d",&a,&b,&c);
	max=a>b?a:b;
	max=max>c?max:c;
	printf("%d\n",max);
	return 0;
}

Solution C++

#include<iostream>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c;
	if (a>b)
		d=a;
	else
		d=b;
	if (d>c)
		d=d;
	else
		d=c;
	cout<<d<<endl;
	return 0;
}
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题