160809230张钊·
#include <stdio.h> int main() { float a,tax=0,TaxIncome=0; printf("请输入您本月收入总额(元):"); scanf("%f",&a); if(a<=1455) { tax=(a-3500)*0.03-0; TaxIncome=a-tax; } else if(a>1455 || a<=4155) { tax=(a-3500)*0.1-105; TaxIncome=a-tax; } else if(a>4155 || a<=7755) { tax=(a-3500)*0.2-555; TaxIncome=a-tax; } else if(a<7755 || a<=27255) { tax=(a-3500)*0.25-1005; TaxIncome=a-tax; } else if(a>27255 || a<=41255) { tax=(a-3500)*0.3-2755; TaxIncome=a-tax; } else if(a>41255 || a<=57505) { tax=(a-3500)*0.35-5505; TaxIncome=a-tax; } else { tax=(a-3500)*0.45-13505; TaxIncome=a-tax; } printf("您本月应缴税为:%f\n您本月的税后收入为:%f\n",tax,TaxIncome); return 0; }
#include <stdio.h> #include <math.h> int main() { float a,b,c,p,s,d; printf("请输入边长:\n"); scanf("%f%f%f",&a,&b,&c); if(a+b>c&&a+c>b&&b+c>a) { printf("能够构成三角形\n"); } else{ printf("不能构成三角形\n"); return 0; } p=(a+b+c)/2; s=sqrt(p*(p-a)*(p-b)*(p-c)); printf("面积是:%f\n",s); d=(a+b+c); printf("周长是:%f\n",d); return 0; return 0 } 运行结果抓图
#include <stdio.h> int main() { float a,tax=0,TaxIncome=0; printf("请输入您本月收入总额(元):"); scanf("%f",&a); if(a<=1455) { tax=(a-3500)*0.03-0; TaxIncome=a-tax; } else if(a>1455 || a<=4155) { tax=(a-3500)*0.1-105; TaxIncome=a-tax; } else if(a>4155 || a<=7755) { tax=(a-3500)*0.2-555; TaxIncome=a-tax; } else if(a<7755 || a<=27255) { tax=(a-3500)*0.25-1005; TaxIncome=a-tax; } else if(a>27255 || a<=41255) { tax=(a-3500)*0.3-2755; TaxIncome=a-tax; } else if(a>41255 || a<=57505) { tax=(a-3500)*0.35-5505; TaxIncome=a-tax; } else { tax=(a-3500)*0.45-13505; TaxIncome=a-tax; } printf("您本月应缴税为:%f\n您本月的税后收入为:%f\n",tax,TaxIncome); return 0; }
这是一次艰难的作业,在本次作业中我遇到了不少的困难,就比如第一题的else语句在第一个作业之中时特别要强调的.第二题对我来说没什么难度外加老师在上课的时候也讲过所以我能很快地解决这道题.第三题对我来说是难度比较大的一道题,应为这道题涉及到float salary,tax=0,afterTaxIncome=0;还有就是在swith语句的应用中不时特别熟练,希望老师能过多加讲解.在开始的时候不太理解这个语句,也是通过问同学最后才弄懂了,所以在以后的客商我会更加认真地听讲,下来完成老师布置的作业.