用c语言编写一道程序,从键盘上输入两个数,输出其中最大的一个数

如题所述

#include<stdio.h>
int main(void)
{
int a,b;
printf("请两个输入数值,中间用空格隔开:");
scanf("%d%d",&a,&b);
if(a>b) {printf("最大值为%d\n",a);}
else {printf("最大值为%d\n",b);}
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2018-12-16
#include <stdio.h>

int max(int a, int b){
    return a>=b ? a : b;
}

int main(){
    int a, b;
    scanf("%d%d", &a, &b);
    printf("%d\n", max(a, b));
    return 0;
}

本回答被网友采纳