- 编写函数返回两个整数中比较大的值。主函数中输入两个整数,输出较大的值。
2.输入样例:
5 8
3.输出样例:
The max is:8.
代码如下
#include<stdio.h>
int GetMax(int a,int b);
int main ()
{
int x,y,max;
scanf("%d%d",&x,&y);
max=GetMax(x,y);
printf("The max is:%d.\n",max);
return 0;
}
int GetMax(int m,int n)
{
if(m>=n)
return m;
else
return n;
}