Time Limit: 1000 ms Memory Limit: 65536 KiB
Problem Description
输入两个整数,请编程求其中的较大者。
Input
在一行中输入用空格隔开的两个整数,例如5 9。
Output
输出两个整数之中较大者,输出形式举例:max=9。
Sample Input
5 9
Sample Output
max=9
Hint
Source
wy
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b;
scanf ("%d%d",&a,&b);
if(a<b)
printf("max=%d\n",b);
else printf("max=%d\n",a);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,max;
scanf("%d%d",&a,&b);
if(a>b)
max = a;
else max = b;
printf ("max=%d\n",max);
return 0;
}
5 9
max=9
Process returned 0 (0x0) execution time : 1.621 s
Press any key to continue.
本文介绍了一个简单的编程问题:如何通过编程找出两个整数中的最大值。提供了使用C语言实现的代码示例,展示了条件判断和输出结果的过程。
551

被折叠的 条评论
为什么被折叠?



