Enter the employee's sales and calculate his bonus automatically

Source: Internet
Author: User

The employee bonus of an enterprise is linked to the employee's sales. The rules are as follows (excess part ):
Sales <= 0.1 million 10%
0.1 million <sales <= 0.2 million 7.5%
0.2 million <sales <= 0.4 million 5%
0.4 million <sales <= 0.6 million 3%
0.6 million <sales <= 1 million 1.5%
1 million <sales: 1%
Please write a program to automatically calculate the bonus based on the sales of the input employee

 

# Include <stdio. h>
Void main ()
{
Double M, S, D;
Printf ("Enter your sales :");
Scanf ("% lf", & S );
If (S <= 10)
{
D = 10.0/100;
}
Else if (S> 10 & S <= 20)
{
D = 7.5/100;
}
Else if (S> 20 & S <= 40)
{
D = 5.0/100;
}
Else if (S> 40 & S <= 60)
{
D = 3.0/100;
}
Else if (S> 60 & S <= 100)
{
D = 1.5/100;
}
Else if (S> 100)
{
D = 1.0/100;
}
M = S * D;
Printf ("Your bonus is: %. 2lf RMB \ n", M );
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.