#include<stdio.h>
double calculator(double income);
int main(void)
{
double income, tax;
printf("Please enter your income:");
scanf_s("%lf", &income);
tax = calculator(income);
printf("Your tax is:%.2f", tax);
return 0;
}
double calculator(double income)
{
if (income < 750)
{
return 0.01 * income;
}
else if (income <= 2250)
{
return 0.02 * (income - 750) + 7.50;
}
else if (income <= 3750)
{
return 0.03 * (income - 2250) + 37.50;
}
else if (income <= 5250)
{
return 0.04 * (income - 3750) + 82.50;
}
else if (income <= 70000)
{
return 0.05 * (income - 5250) + 142.50;
}
else if (income > 70000)
{
return 0.06 * (income - 70000) + 230.00;
}
}
9---2
最新推荐文章于 2024-10-05 23:29:09 发布