#include<stdio.h>
#define MAX(a,b) (a>b?a:b)
int main(void)
{
int a,b,c;
printf("输入三个数:\n");
scanf("%d\n%d\n%d\n",&a,&b,&c);
int temp;
temp=MAX(MAX(a,b),c);
printf("最大数是%d\n",temp);
}
scanf("%d\n%d\n%d\n",&a,&b,&c);里的\n要求多输入回车,一共需要输入5行。所以去掉\n
#define MAX(a,b) (a>b?a:b)
int main(void)
{
int a,b,c;
printf("输入三个数:\n");
scanf("%d %d %d",&a,&b,&c);
int temp;
temp=MAX(MAX(a,b),c);
printf("最大数是%d\n",temp);
}
// Output
输入三个数:
1
2
3
最大数是3
输入三个数:
1 2 3
最大数是3