交稅編程
① c語言:編寫程序,輸入月薪數a,計算並輸出稅率、應繳稅款和實得獎金數。
#include <stdio.h>
void main()
{
double a, rate;
int c,tax,profit;
printf("輸入獎金數:");
scanf("%lf",&a);
if(a>=5000)c=10;
else c=a/500;
switch(c) {
case 0: rate=0; break;
case 1: rate=0.05; break;
case 2:
case 3:
case 4: rate=0.08; break;
case 5:
case 6:
case 7:
case 8:
case 9: rate=0.10; break;
case 10: rate=0.15; break;
}
printf("%d",c);
tax=(a*rate);
profit=(int)(a-tax);
printf("稅率為%lf,應繳稅款為%d,實得獎金數為%d\n",rate,tax,profit);
}
② 怎麼用JAVA編程計算工資個人所得稅
你一開始就 int KGongZ = GongZ-3500; 那我問你工資如果小於3500.不交稅,最後反而要補貼了。。。邏輯有錯誤
③ C語言編程題,求助大佬,謝謝!
#include "stdio.h"
int main(int argc,char *argv[]){
double w,tax;
printf("Please enter the amount of wages before taxes... w=");
if(scanf("%lf",&w)!=1 || w<0){
printf("Input error, exit... ");
return 0;
}
if((w-=3500)<=1500.0)
tax=w*0.03;
else if(w>1500.0 && w<=4500.0)
tax=w*0.1-105;
else if(w>4500.0 && w<=9000.0)
tax=w*0.20-555;
else if(w>9000.0 && w<=35000.0)
tax=w*0.25-1005;
else if(w>35000.0 && w<=55000.0)
tax=w*0.3-2766;
else if(w>55000.0 && w<=80000.0)
tax=w*0.35-5505;
else if(w>80000.0)
tax=w*0.45-13505;
printf(" %.2f ",tax);
return 0;
}
代碼圖片和運行樣例: