zzulioj 1032: employee salary

Title description A
company stipulates that the salary of sales staff consists of two parts: basic salary and sales commission. The basic salary is 1500 yuan/month. The sales commission rules are as follows: when the
sales is less than or equal to 10,000 yuan, a 5% commission is used; the
sales are greater than 10,000 When the
sales amount is more than 50,000 yuan but less than or equal to 50,000 yuan, the part exceeding 10,000 shall be subject to a 3% commission; when the sales amount is greater than 50,000 yuan, the part exceeding 50,000 shall be subject to a 2% commission.
Write a program to calculate employee income based on sales.
Input
Input an integer to indicate sales.
Output
Output the salary of the employee, with 2 decimal places.
Sample input Copy
30000
Sample output Copy
2600.00

#include<stdio.h>
int main()
{
    
    
	int n;
	scanf("%d",&n);
	if(n<=10000)
	  printf("%.2f\n",1500+n*0.05);
	  else if(n>10000&&n<=50000)
	    printf("%.2f\n",1500+(n-10000)*0.03+10000*0.05);
	    else 
	      printf("%.2f\n",1500+(n-50000)*0.02+40000*0.03+10000*0.05);
	return 0;
}

Guess you like

Origin blog.csdn.net/m0_53024529/article/details/112846120