Codeup question E: 4-10-1 bonus calculation exercises

1 title

Question E: Exercise 4-10-1 bonus calculation
time limit: 1 Sec Memory Limit: 12 MB
submission: 2570 Resolution: 2016
[submit] [state] [Discussion Board] [proposition man: External Import]
title describes
a company issued bonuses based on profit commission. Profit I less than or equal 100,000, can provide bonuses of 10%; when the profit of more than $ 100,000, less than 200,000 yuan (100000 <I <= 200000) , below 100,000 membered partially based upon 10% commission, higher than 100,000 Percent element portion is 7.5%; 200000 <I <= 400,000 when less than 200,000 yuan portion commission based upon the above method (hereinafter the same), in which more than 5% of the 200,000 yuan commission; 400000 <I <= 600000 yuan, in which more than 400,000 yuan of 3% commission; 600000 <I <= 1000000, the part higher than 600,000 yuan commission is 1.5%; I> when 1 million yuan, more than one million yuan portion 1% commission.

Output from the keyboard month profit I, seeking to be made a few bonus, bonus to the minutes.

Required to achieve with the if statement.

Enter
corporate profits, decimal, double, double type
output
should send a few bonus, 2 decimal places, the end of the wrap.
Sample input
1050
Sample Output
105.00

2 reference code

#include<stdio.h>
int main(int argc, char const *argv[])
{
	double db;
	scanf("%lf",&db);
	if(db<=100000){
		printf("%.2f\n",db*0.1);
	}else if(db>100000&&db<=200000){
		printf("%.2f\n",(db-100000)*0.075+10000);
	}else if(db>200000&&db<=400000){
		printf("%.2f\n",(db-200000)*0.05+17500);
	}else if(db>400000&&db<=600000){
		printf("%.2f\n", (db-400000)*0.03+27500);
	}else if(db>600000&&db<=1000000){
		printf("%.2f\n", (db-600000)*1.5+33500);
	}else{
		printf("%.2f\n",(db-1000000)*0.1+36500);
	}
	return 0;
}
Published 321 original articles · won praise 51 · views 40000 +

Guess you like

Origin blog.csdn.net/qq_33375598/article/details/104060055