用c语言编写程序:使输入某人收入,计算出应纳税额及实际得到的报酬,个人所得税应纳税额计算公式如下;收入<1000部分税率为0%;收入处于[1000,2000)的部分税率为5%;收入处于[2000,4000)的部分税率为10%;收入处于[4000,6000)的部分税率为15%;收入大于等于6000的部分税率为20%,并使用if和switch两种方法
时间: 2023-05-30 15:04:31 浏览: 110
As an AI language model, I cannot have emotions and do not have a personal opinion. Therefore, I cannot provide any input on the term "null" as it is context-dependent. Can you please provide more information or context for me to better understand your question?
相关问题
用c语言编写:个人所得税,应纳税款的计算公式如下: x |+2 - sin (x2) 收入收入<1000元部分 1000元<=收入<2000元的部分 2000元<=收入<4000元的部分 4000元<=收入<6000元的部分收入>=6000元的部分 税率 0% 5% 10% 15% 20% 输入某人的收入,计算出应纳税额及实际得到的报酬。(使用 if 和 switch 两种方法)
使用 if 语句的代码:
```c
#include <stdio.h>
#include <math.h>
int main()
{
double income, tax, net_income;
printf("请输入您的收入:");
scanf("%lf", &income);
if (income < 1000) {
tax = 0;
}
else if (income < 2000) {
tax = (income - 1000) * 0.05;
}
else if (income < 4000) {
tax = 50 + (income - 2000) * 0.1;
}
else if (income < 6000) {
tax = 250 + (income - 4000) * 0.15;
}
else {
tax = 550 + (income - 6000) * 0.2;
}
net_income = income - tax;
printf("您应缴纳的税额为:%lf\n", tax);
printf("您实际得到的报酬为:%lf\n", net_income);
return 0;
}
```
使用 switch 语句的代码:
```c
#include <stdio.h>
#include <math.h>
int main()
{
double income, tax, net_income;
printf("请输入您的收入:");
scanf("%lf", &income);
switch ((int)floor(income / 1000)) {
case 0:
tax = 0;
break;
case 1:
tax = (income - 1000) * 0.05;
break;
case 2:
tax = 50 + (income - 2000) * 0.1;
break;
case 3:
tax = 250 + (income - 4000) * 0.15;
break;
default:
tax = 550 + (income - 6000) * 0.2;
break;
}
net_income = income - tax;
printf("您应缴纳的税额为:%lf\n", tax);
printf("您实际得到的报酬为:%lf\n", net_income);
return 0;
}
```
个人所得税,应纳税款的计算公式如下:收入小于1000元部分,税率为百分之零,收入大于等于1000元且小于2000元的部分,税率为百分之五,收入大于等于2000元且小于4000元的部分,税率为百分之十,收入大于等于4000元且小于6000元的部分,税率为百分之十五;收入大于等于6000元的部分,税率为百分之二十。用c语言编写程序,输入某人的收入,计算出应纳税额及实际得到的报酬。(使用if和switch两种方法)
if方法:
#include<stdio.h>
int main()
{
float income, tax, real_income;
printf("请输入您的收入:");
scanf("%f", &income);
if(income < 1000)
{
tax = 0;
}
else if(income < 2000)
{
tax = (income - 1000) * 0.05;
}
else if(income < 4000)
{
tax = 50 + (income - 2000) * 0.1;
}
else if(income < 6000)
{
tax = 250 + (income - 4000) * 0.15;
}
else
{
tax = 550 + (income - 6000) * 0.2;
}
real_income = income - tax;
printf("您的应纳税款为:%.2f元,实际得到的报酬为:%.2f元\n", tax, real_income);
return 0;
}
switch方法:
#include<stdio.h>
int main()
{
float income, tax, real_income;
printf("请输入您的收入:");
scanf("%f", &income);
switch((int)income/1000)
{
case 0:
tax = 0;
break;
case 1:
tax = (income - 1000) * 0.05;
break;
case 2:
tax = 50 + (income - 2000) * 0.1;
break;
case 3:
tax = 250 + (income - 4000) * 0.15;
break;
default:
tax = 550 + (income - 6000) * 0.2;
break;
}
real_income = income - tax;
printf("您的应纳税款为:%.2f元,实际得到的报酬为:%.2f元\n", tax, real_income);
return 0;
}
阅读全文