代码如下:
#include<stdio.h>
// 写一个函数,功能: 计算两个整数中的较大值,并返回
//int getBigger(int x, int y){
// if(x > y){
// return x;
// } else {
// return y;
// }
//}
int getBigger(int x, int y){
return x > y ? x : y;
}
int getBiggest(int a, int b, int c){
if (a>=b && a >= c){
return a;
} else if (b >= a && b >= c){
return b;
} else{
return c;
}
}
int main(){
//int rst = getBigger(10,20);
int rst = getBiggest(10,20,3);
printf("%d", rst);//20
}
结果如下: