#include <stdio.h>
int main() {
int distance;
printf("请输入航班的飞行距离(公里):");
scanf("%d", &distance);
int price = 0;
if (distance <= 100) {
price = 400;
} else if (distance <= 500) {
price = 400 + (distance - 100) * 4;
} else if (distance <= 2000) {
price = 400 + 400 * 4 + (distance - 500) * 3;
} else {
price = 400 + 400 * 4 + 1500 * 3 + (distance - 2000) * 2;
printf("该航班的价格为:%d 元\n", price);
return 0;
}
为啥啊,有大佬能帮忙看看吗
int main() {
int distance;
printf("请输入航班的飞行距离(公里):");
scanf("%d", &distance);
int price = 0;
if (distance <= 100) {
price = 400;
} else if (distance <= 500) {
price = 400 + (distance - 100) * 4;
} else if (distance <= 2000) {
price = 400 + 400 * 4 + (distance - 500) * 3;
} else {
price = 400 + 400 * 4 + 1500 * 3 + (distance - 2000) * 2;
printf("该航班的价格为:%d 元\n", price);
return 0;
}
为啥啊,有大佬能帮忙看看吗