一、问题描述:
二、设计思路:
利用if else嵌套就行,分情况把没一段都写出来
三、程序流程图:
四、代码实现
#include<stdio.h> int main() { int x,y; scanf("%d",&x); if(x>3500) { if(x<5000) { y=(x-3500)*0.03; printf("%d",y); } else if(x>=5000&&x<8000) { y=45+(x-5000)*0.1; printf("%d",y); } else if(x>=8000&&x<12500) { y=45+300+(x-8000)*0.2; printf("%d",y); } else if(x>=12500&&x<38500) { y=1500*0.03+3000*0.1+4500*0.2+(x-12500)*0.25; printf("%d",y); } else if(x>=38500&&x<58500) { y=1500*0.03+3000*0.1+4500*0.2+26000*0.25+(x-38500)*0.3; printf("%d",y); } else if(x>=58500&&x<83500) { y=1500*0.03+3000*0.1+4500*0.2+26000*0.25+20000*0.3+(x-58500)*0.35; printf("%d",y); } else if(x>83500) { y=1500*0.03+3000*0.1+4500*0.2+26000*0.25+20000*0.3+25000*0.35+(x-83500)*0.45; printf("%d",y); } } else printf("无需缴个人所得税"); return 0; }
后续还有结构体的写法,敬请期待
标签:int,else,问题,个人所得税,敬请期待,&&,printf From: https://www.cnblogs.com/bzsc/p/17352603.html