Description
某公园门票的票价是每人50元,一次购票满30张,每张可以少收2元。试编写自动计费系统程序。
Input
输入一个正整数,表示购票的数量。
Output
输出一个实数,表示用户实际需要支付的金额,保留两位小数。
Sample Input
30
Sample Output
1440.00
HINT
...
Source
#include<stdio.h>
#define PRICE 50 //票价定义为符号常量,便于修改
int main(void)
{
int n;
double total;
scanf("%d", &n);
if(n >= 30 ) //若购票数量达到30,每张优惠2元
total = n * (PRICE - 2);
else
total = n * PRICE;
printf("%.2f\n", total);
return 0;
}