# C practical exercise topic 2

Time：2021-2-23

Title:The bonus paid by the enterprise is based on the profit commission.

• When the profit (I) is less than or equal to 100000 yuan, the bonus can be increased by 10%;
• When the profit is higher than 100000 yuan and lower than 200000 yuan, the part below 100000 yuan will be charged with 10% commission, and the part above 100000 yuan will be charged with 7.5% commission;
• When the amount is between 200000 and 400000 yuan, the portion higher than 200000 yuan can be deducted by 5%;
• If it is between 400000 yuan and 600000 yuan, the Commission will be 3%;
• In the range of 600000 to 1000000 yuan, 1.5% can be deducted for the part higher than 600000 yuan;
• When it is higher than 1 million yuan, the part exceeding 1 million yuan will be charged with 1% commission.

Enter the monthly profit I from the keyboard to calculate the total amount of bonus?

Program analysis:Please use the number axis to delimit and locate. Pay attention to the definition of bonus should be defined as growth integer.

example:

``````#include
int main()
{
double i;
double bonus1,bonus2,bonus4,bonus6,bonus10,bonus;
scanf("%lf",&i);
bonus1=100000*0.1;
bonus2=bonus1+100000*0.075;
bonus4=bonus2+200000*0.05;
bonus6=bonus4+200000*0.03;
bonus10=bonus6+400000*0.015;
if(i<=100000) {
bonus=i*0.1;
} else if(i<=200000) {
bonus=bonus1+(i-100000)*0.075;
} else if(i<=400000) {
bonus=bonus2+(i-200000)*0.05;
} else if(i<=600000) {
bonus=bonus4+(i-400000)*0.03;
} else if(i<=1000000) {
bonus=bonus6+(i-600000)*0.015;
} else if(i>1000000) {
bonus=bonus10+(i-1000000)*0.01;
}
Printf ("proposed as: bones =% lf", bones) ";

printf("\n");
}``````

The output results of the above examples are as follows:

``````Your net profit is:
120000
Raised as: bonus = 11500.000000``````