第2题,比较出4个整数的最大值,这么写行不行?
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c,d,temp1,temp2;
scanf("%d %d %d %d",&a,&b,&c,&d);
if(a<b) temp1=b;
else temp1=a;
if(c<d) temp2=d;
else temp2=c;
if(temp1<temp2) printf("%d",temp2);
else printf("%d",temp1);
system("pause");
return 0;
}
反正编译是没问题的! |