求解这道编程题怎么做
解决时间 2021-03-10 01:57
- 提问者网友:欺烟
- 2021-03-09 06:36
我的代码如下求大神修改
————————————————————————————————————————————————
#include
int main(void)
{
int n;
float tax;
printf("请输入你的收入:");
scanf("%d", n);
if(n < 750)
{
tax = n * 0.02;
printf("你所需要缴纳的税:" tax);
}
else if(n >= 750 && n <= 2250)
{
tax = 7.50 + (n - 750) *0.02;
printf("你所需要缴纳的税:" tax);
}
else if(n > 2250 && n <= 3750)
{tax = 37.50 + (n - 2250)*0.03;
printf("你所需要缴纳的税:" tax);
}
else if(n > 3750 && n <= 5250)
{tax = 82.50 +(n - 3750)*0.04;
printf("你所需要缴纳的税:" tax);
}
else if(n > 5250 && n<= 7000);
{tax = 142.50 +(n - 5250)*0.05;
printf"你所需要缴纳的税:" tax);
}
else if(n >7000)
{tax = 230.50 +(n - 7000)*0.06;
printf"你所需要缴纳的税" tax);
}
return 0;
}
最佳答案
- 五星知识达人网友:神的生死簿
- 2021-03-09 08:00
#include
int main(void)
{
int n;
float tax;
printf("请输入你的收入:");
scanf("%d", &n);
if(n <= 750)
{
tax = n * 0.01;
printf("你所需要缴纳的税:%.2f\n", tax);
}
else if(n > 750 && n <= 2250)
{
tax = 7.50 + (n - 750) *0.02;
printf("你所需要缴纳的税:%.2f\n", tax);
}
else if(n > 2250 && n <= 3750)
{tax = 37.50 + (n - 2250)*0.03;
printf("你所需要缴纳的税:%.2f\n", tax);
}
else if(n > 3750 && n <= 5250)
{tax = 82.50 +(n - 3750)*0.04;
printf("你所需要缴纳的税:%.2f\n", tax);
}
else if(n > 5250 && n<= 7000)
{tax = 142.50 +(n - 5250)*0.05;
printf("你所需要缴纳的税:%.2f\n", tax);
}
else if(n >7000)
{tax = 230.00 +(n - 7000)*0.06;
printf("你所需要缴纳的税:%.2f\n", tax);
}
return 0;
}
望采纳。
全部回答
最近无聊。。不知道你这是什么题。。玩玩而已
#include
#include
#include
#define max 100
int main()
{ char de[max]={'0'};
printf("请输入密码:\n");
gets(de);
for(int i=0;de[i]!='\0';i++)
{de[i]=de[i]+4; }
printf("密码为:%s",de);
system("pause");
return 0;}
#include
#include
#include
#define max 9
int main()
{ char de[max]={'0'};
printf("请输入密码:\n");
gets(de);
for(int i=0;(i<9)&&(de[i]!='\0');i+=2)
{ if((de[i]<='c')||((de[i]>='a')&&(de[i]<='c'))) continue;
de[i]=de[i]-3;
}
for(int i=1;(i<9)&&(de[i]!='\0');i+=2)
{ if((de[i]<='z')&&(de[i]>='w')||(de[i]>='w')) continue;
de[i]=de[i]+4;
}
printf("密码为:%s",de);
system("pause");
return 0;}
不怪我的代码多。你这题问题太多。。出题的人。。根本就垃圾。。一般情况是垃圾书。
后面的题 百度hi我、太多了。。打不下。。。
我挺怕后面的人骂我耽误学生的。前面的朋友 说的对。你应该亲自动手写。忠言逆耳啊。
我要举报
大家都在看
推荐资讯