1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-11-23 15:48:42 +00:00
202401-programming-assignments/【额外练习】选择结构/7-40 选择-工资计算.c

25 lines
477 B
C
Raw Normal View History

2024-11-02 14:07:00 +00:00
#include <stdio.h>
int main() {
int year;
double time;
scanf("%d%lf", &year, &time);
if (year >= 5) {
if (time <= 40) {
printf("%.2lf\n", time * 50);
} else {
printf("%.2lf\n", 40 * 50 + (time - 40) * 50 * 1.5);
}
} else {
if (time <= 40) {
printf("%.2lf\n", time * 30);
} else {
printf("%.2lf\n", 40 * 30 + (time - 40) * 30 * 1.5);
}
}
return 0;
}