方法1:

#include<stdio.h>
int main()
{
int a, b, c, max;
printf("Please enter three number: ");
scanf("%d,%d,%d", &a, &b, &c);
if (a > b){
if (a > c){
max = a;
}
else{
max = c;
}
}
else{
if (b > c){
max = b;
}
else{
max = c;
}
}
printf("max=%d\n", max);
}


方法2:

#include<stdio.h>
int main()
{
int a, b, c, max;
printf("Please enter three number: ");
scanf("%d,%d,%d", &a, &b, &c);
max = a > b ? (a > c ? a : c) : (b > c? b:c);
printf("max=%d\n", max);
}