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

 

 

函数接口定义

int max(int a, int b);

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

 

测试测试样例

#include <stadio.h>
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;
}

 

posted @ 2021-11-16 00:45  漫漫长路</>  阅读(64)  评论(0编辑  收藏  举报