1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-12-16 15:44:39 +00:00
202401-programming-assignments/【实践课内】12.函数3/6-3 累计销售.c

10 lines
171 B
C
Raw Normal View History

2024-11-27 02:25:12 +00:00
double price(double x) {
static double sum = 0;
sum += x;
if (sum < 5000) return sum * 0.01;
if (sum < 10000) return sum * 0.05;
return sum * 0.1;
}