我想计算C编程中给定的三个整数中的最大值,而不使用任何if
/else
条件或switch
大小写.例如,以这种方式.
#include <stdio.h>
#include <stdlib.h>
int main() {
int num1, num2, max;
scanf("%d %d", &num1, &num2);
max = (num1 + num2 + abs(num1 - num2)) /2;
printf("%d\n", max);
return 0;
}
这是我计算给定两个整数的最大值的代码.