清淨氣溫:
#include <stdio.h>
#include <stdlib.h>
int main(){
char *std_num="123456", *name="XXX";
printf("學號:%s \n姓名:%s \n", std_num, name);
float surface_temp; //平地氣溫
float qingjing_temp; //清淨氣溫
printf("請輸入平地氣溫:");
scanf("%f", &surface_temp);
qingjing_temp = surface_temp-(17*0.6);
printf("清淨氣溫為:%.1f\n", qingjing_temp);
system("PAUSE");
return 0;
}
所得稅計算:
#include <stdio.h>
#include <stdlib.h>
int main(){
char *std_num="123456", *name="XXX";
printf("學號:%s \n姓名:%s \n", std_num, name);
int income; //收入
float tax; //稅額
//稅率
int s5 = 54*10000*0.05; //5%
int s12 = 67*10000*0.12; //12%
int s20 = 121*10000*0.2; //20%
int s30 = 211*10000*0.3; //30%
//40%
printf("請輸入收入(萬元):");
scanf("%d", &income);
if (income < 54)
tax = income*10000*0.05;
else if (income <= 121)
tax = (income-54)*10000*0.12+s5;
else if (income <= 242)
tax = (income-121)*10000*0.2+s12+s5;
else if (income <= 453)
tax = (income-242)*10000*0.3+s20+s12+s5;
else if (income < 453)
tax = income*10000*0.4+s30+s20+s12+s5;
else
tax = income*10000*0.05;
printf("應繳稅額為:%.0f\n", tax);
system("PAUSE");
return 0;
}