函数题---练习5-2--找两个数中最大者


函数接口定义

int max(int a, int b);

其中a和b是用户传入的参数,函数返回的是两者中较大的数。

测试测试样例

#include 
int max(int a, int b);

int main()
{
  int a,b;

  scanf("%d %d",&a,&b);
    
  printf("max = %d\n",max(a,b))

return 0;  
}

答案

int max(int a,int b){
if(a>b){
return a;
}
else return b;
}

相关