#include
int main()
{int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
printf("max2=%d\n",a>b?a:b);
printf("max3=%d\n",(a>b?a:b)>c?(a>b?a:b):c);
printf("max4=%d\n",(a>b?a:b)>(c>d?c:d)?(a>b?a:b):(c>d?c:d));
return 0;
}
#include
int maxtwo(int a,int b)
{
return a>b?a:b;
}
int maxthree(int a,int b,int c)
{
return (a>b?a:b)>c?a:c;
}
int maxfour(int a,int b,int c,int d)
{
return ((a>b?a:b)>c?a:c)>d?c:d;
}
int main()
{
int a=1,b=2,c=3,d=4;
printf("max2[%d]\n",maxtwo(a,b));
printf("max3[%d]\n",maxthree(a,b,c));
printf("max4[%d]\n",maxfour(a,b,c,d));
return 0;
}
max2[2]
max3[3]
max4[4]
Press any key to continue