实例挑战
(if条件语句实战运用)
include<stdio.h>
int main(){
int salary;//记录工资
int pay;//税后工资
//接受输入
printf("请输入工资:");
scanf("%d",&salary);
//开始计算
if(salary<5000){
pay=salary;
}else if(salary>5000&&salary<8000){
pay=salary-(salary-5000)* 0.1;
}else if(salary>8000&&salary<10000){
pay=salary-(salary-8000)* 0.15-3000* 0.1;
}else{
pay=salary-(salary-10000)* 0.2-2000*0.15-3000 *0.1;
}
printf("到手工资:%d",pay);
return 0;
}