只有三个数,用if分支就可以了:
//#include "stdafx.h"//If the vc++6.0, with this line.
#include "stdio.h"
int main(void){
int a,b,c,max;
printf("Input 3 integers...\n");
scanf("%d%d%d",&a,&b,&c);
if(a>=b && a>=c)
max=a;
else if(b>=a && b>=c)
max=b;
else if(c>=a && c>=b)
max=c;
printf("The MAX is %d\n",max);
return 0;
}
#include
void main()
{int a,b,c,max;
scanf("%d%d%d",&a,&b,&c);
max=a;
if(b>max)max=b;
if(c>max)max=c;
printf("max=%d\n",max);
}
#define MAX1(a,b,c) ((a)>(b)?(a>c?a:c):(b>c?b:c))
#include
#include
void main()
{ int a,b,c;
int max;
printf("input three number :\n");
scanf("%d%d%d",&a,&b,&c); //
if(a>b)
max=c>a?c:a;
else
max=c>b?c:b;
printf("%d\n",max); /
system("pause");
return 0;
}
已经测试