c语言编程税收计算器

LS的算法是错的,根本没理解个人所得税是怎么算的 #include "stdio.h"void main(void){ float num; printf("Please enter you num :\r\n"); scanf("%f",&num); if(num <= 2000) printf("The income is :%.2f\r\n",num); if((num > 2000)&&(num <= 2500) ) printf("The income is :%.2f\r\n",((num-2000)*0.95 +2000)); if((num > 2500)&&(num <= 4000) ) printf("The income is :%.2f\r\n",(num-2500)*0.90 +2000+500*0.95); if((num > 4000)&&(num <= 7000) ) printf("The income is :%.2f\r\n",(num-4000)*0.85 +2000+500*0.95+1500*0.90); if((num > 7000)&&(num <= 22000) ) printf("The income is :%.2f\r\n",(num-7000)*0.80 +2000+500*0.95+1500*0.90+3000*0.85); if((num > 22000)&&(num <= 42000) ) printf("The income is :%.2f\r\n",(num-22000)*0.75 +2000+500*0.95+1500*0.90+3000*0.85+15000*0.80); if((num > 42000)&&(num <= 62000) ) printf("The income is :%.2f\r\n",(num-42000)*0.70 +2000+500*0.95+1500*0.90+3000*0.85+15000*0.80+20000*0.75); if((num > 62000)&&(num <= 82000) ) printf("The income is :%.2f\r\n",(num-62000)*0.65 +2000+500*0.95+1500*0.90+3000*0.85+15000*0.80+20000*0.75+20000*0.70); if((num > 82000)&&(num <= 102000) ) printf("The income is :%.2f\r\n",(num-82000)*0.60 +2000+500*0.95+1500*0.90+3000*0.85+15000*0.80+20000*0.75+20000*0.70+20000*0.65); if((num > 102000)) printf("The income is :%.2f\r\n",(num-102000)*0.55 +2000+500*0.95+1500*0.90+3000*0.85+15000*0.80+20000*0.75+20000*0.70+20000*0.65+20000*0.60); while(1);}最只管的算法,直接算,其中的常数我没有计算,便于理解

#include <stdio.h>int main(void){ long c, m; printf("请输入超出部分:"); scanf("%ld", &c); if(c<500) { m = c*0.95; printf("总的收入是:%ld\n", m+2000); } else if(c<2000) { m = c*0.9; printf("总的收入是:%ld\n", 2000+m); } else if(c<5000) { m = c*0.85; printf("总的收入是:%ld\n", 2000+m); } else if(c<20000) { m = c*0.8; printf("总的收入是:%ld\n", 2000+m); } else if(c<40000) { m = c*0.75; printf("总的收入是:%ld\n", 2000+m); } else if(c<60000) { m = c*0.7; printf("总的收入是:%ld\n", 2000+m); } else if(c<80000) { m = c*0.65; printf("总的收入是:%ld\n", 2000+m); } else if(c<100000) { m = c*0.6; printf("总的收入是:%ld\n", 2000+m); } else { m = c*0.55; printf("总的收入是:%ld\n", 2000+m); } return 0;} 本回答被提问者和网友采纳

典型的if判断语句

如果我的回答你还满意记得选个满意答案哦#include<stdio.h>void main(){ float a,b; char c; printf("请输入两个操作数:"); scanf("%f",&a); scanf("%f",&b); getchar(); printf("请选择操作运算:"); scanf("%c",&c); switch(c) { case '+': printf("结果是:%f\n",a+b); break; case '-': printf("结果是:%f\n",a-b); break; case '*': printf("结果是:%f\n",a*b); break; case '/': printf("结果是:%f\n",a/b); break; default: printf("无此操作!"); } }

太模糊了,啥都看不清 更多追问追答 追问 被压缩了 追答 #include int main(){ double p,x,s,r; printf("输入收入:"); scanf("%lf",&p); if(p<=3500){ x=0; s=0; }else if(p<5000){ x=0.03; s=0; }else if(p<8000){ x=0.1; s=105; }else if(p<12500){ x=0.2; s=555; }else if(p<38500){ x=0.25; s=1005; }else if(p<58500){ x=0.3; s=2755; }else if(p<83500){ x=0.35; s=5505; }else{ x=0.45; s=13505; } r=(p-3500)*x-s; printf("所得税:%.2lf\n",r); return 0;} 追问 能把第六题弄了吗 追答 #include int main(){ int x,y; printf("Input x:"); scanf("%d",&x); if(x=10) y=3*x-11; else y=2*x-1; printf("y = %d",y); return 0;} 追问 感谢 本回答由提问者推荐

#include"stdio.h"double count(int a,int b){ double c=a-b-3500; if(c<=0) c=0; else if(c<=1500) c=c*0.03; else if(c<=4500) c=c*0.1-105; else if(c<=9000) c=c*0.2-555; else if(c<=35000) c=c*0.25-1005; else if(c<=55000) c=c*0.3-2755; else if(c<=80000) c=c*0.35-5505; else c=c*0.45-13505; return c;}void main(){ int chose; while(1) { printf("\t\t个人所得税计算器\n"); printf("1.计算个人所得税\n"); printf("2.退出\n"); printf("请输入选项(1或2):"); scanf("%d",&chose); if(chose==2) break; else if(chose==1) { int pay,baoxian; printf("\n输入你的月收入:"); scanf("%d",&pay); printf("\n输入你的三险一金:"); scanf("%d",&baoxian); printf("你的个人所得税为:%0.2f",count(pay,baoxian)); } else { printf("\n\t\t>>>注意:请输入1或2<<<\n"); } } }

根据2011年9月1日起调整后的7级超额累进税率设计,调试通过#include"stdio.h"double count(int a,int b){ double c=a-b-3500; if(c<=0) c=0; else if(c<=1500) c=c*0.03; else if(c<=4500) c=c*0.1-105; else if(c<=9000) c=c*0.2-555; else if(c<=35000) c=c*0.25-1005; else if(c<=55000) c=c*0.3-2755; else if(c<=80000) c=c*0.35-5505; else c=c*0.45-13505; return c;}void main(){ int chose; while(1) { printf("\t\t个人所得税计算器\n"); printf("1.计算个人所得税\n"); printf("2.退出\n"); printf("请输入选项(1或2):"); scanf("%d",&chose); if(chose==2) break; else if(chose==1) { int pay,baoxian; printf("\n输入你的月收入:"); scanf("%d",&pay); printf("\n输入你的三险一金:"); scanf("%d",&baoxian); printf("你的个人所得税为:%0.2f",count(pay,baoxian)); } else { printf("\n\t\t>>>注意:请输入1或2<<<\n"); } } } 更多追问追答 追问 a和b分别表示什么?a-b表示什么? 追答 a表示 月总工资b表示 三险一金月总工资减去三险一金再减去 3500,就是要缴税的收入了 追问 今天看程序的时候有个地方不太明白,就是while(1){printf("\t\t个人所得税计算器\n");printf("1.计算个人所得税\n");printf("2.退出\n");printf("请输入选项(1或2):");scanf("%d",&chose);if(chose==2)break;我不明白为什么要把while循环加在这里? 追答 你计算个人所得税,不想用一次程序就关闭了吧。运行一下,你就知道了 追问 嗯,谢谢,因为运行软件64位的没有安装成功所以跟你问问,谢谢帮忙 追答 不客气,选我为最佳答案吧 本回答被提问者和网友采纳

就是按照现行的个人所得税征收标准编写的程序吗?我去年写过一个 追问 可以自动调整各税起征点吗?能循环输入员工的收入吗?

这个页面的代码可以改下,就行了。http://finance.21cn.com/bank/computer/tax.html

#include"stdio.h"double count(int a,int b){ double c=a-b-3500; if(c<=0) c=0; else if(c<=1500) c=c*0.03; else if(c<=4500) c=c*0.1-105; else if(c<=9000) c=c*0.2-555; else if(c<=35000) c=c*0.25-1005; else if(c<=55000) c=c*0.3-2755; else if(c<=80000) c=c*0.35-5505; else c=c*0.45-13505; return c;}void main(){ int chose; while(1) { printf("\t\t个人所得税计算器\n"); printf("1.计算个人所得税\n"); printf("2.退出\n"); printf("请输入选项(1或2):"); scanf("%d",&chose); if(chose==2) break; else if(chose==1) { int pay,baoxian; printf("\n输入你的月收入:"); scanf("%d",&pay); printf("\n输入你的三险一金:"); scanf("%d",&baoxian); printf("你的个人所得税为:%0.2f",count(pay,baoxian)); } else { printf("\n\t\t>>>注意:请输入1或2<<<\n"); } } }

#include <stdio.h>#include <stdlib.h>int main(){    int i;    int j;    int sum = 0;    for(i=1;i<=10;i++) {  j=3*i;  sum+=j; } printf("Sum = %d",sum);    return 0;} 本回答被提问者采纳

b=1+3+6+10+15……+的前10项和#include <stdio.h>main(){int a=0,b=0,i; for(i=1;i<=10;i++) { a=a+i; b=b+a; } printf(“%d”,b);}这是入门级的程序,希望能帮助你了解c语言。😊

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

boke