发布网友 发布时间:2024-02-17 06:27
共1个回答
热心网友 时间:2024-02-19 17:14
#include<stdio.h>void main(){ int i = 0 , j = 0; printf("请输入利润值") scanf("%d",&i); float total = 0 ; float k_hundred,k_sixty,k_forty,k_twenty,k_ten,k; if ( i > 10) { j = 10; else if ( i <= 20 && i > 10) j = 20; else if ( i <= 40 && i > 20 ) j = 40; else if ( i < = 60 && i > 40) j = 60; else if ( i < = 100 && i > 60) j = 100; } if ( i > 100) { k_hundred = i - 100; else if ( i <= 100 && i > 60) k_sixty = i - 60; else if ( i <= 60 && i > 40 ) k_forty = i - 40; else if ( i < = 40 && i > 20) k_twenty = i - 40; else if ( i < = 20 && i > 10) k_ten = i - 20 ; else if ( i < = 10 && i >= 0) k = i; } swich(j) { case 100 total = k_hundred * 0.01+ k_sixty * 0.015 + k_forty * 0.03 + k_twenty * 0.05 + k_ten * 0.075 + k * 0.1;break; case 60 :total = k_sixty * 0.015 + k_forty * 0.03 + k_twenty * 0.05 + k_ten * 0.075 + k * 0.1;break; case 40 :total = k_forty * 0.03 + k_twenty * 0.05 + k_ten * 0.075 + k * 0.1;break; case 20 :total = k_twenty * 0.05 + k_ten * 0.075 + k * 0.1;break; case 10 :total = k_ten * 0.075 + k * 0.1;break; case 0 : total = k * 0.1;break; } printf("奖金为%f",total);}