C language · Salary Calculation

Source: Internet
Author: User

Problem description Write a program that calculates the employee's weekly salary. The salary is calculated in hours, and if the employee does not work more than 40 hours in a week, his or her total income equals the working time multiplied by the hourly salary. If the employee is working between 40-50 hours, then for the first 40 hours it is still calculated as usual, while for the remainder of the excess, the hourly salary is calculated at 1.5 times times. If the employee has been working for more than 50 hours, then for the first 40 hours it is still calculated as usual, and for the portion between 40-50 hours, the hourly salary is calculated at 1.5 times times, and for the portion exceeding 50 hours, the hourly salary is calculated at twice times. Write a program that enters the employee's working hours and hourly salary, then calculates and displays the weekly wage he or she should get.
Input format: Enter only one row, including an integer and a real number, representing the working time and hourly salary, respectively.
Output format: The output has only one real number, which represents a weekly wage and retains 2 digits after the decimal point.
Input and Output sample sample input 40 50 sample output 2000.00
1 /*2 If the employee is working in between 40-50 and eight hours,3 then for the first 40 hours, still calculated according to the conventional method;4 for the remainder of the excess, hourly salary is calculated at 1.5 times times. 5 If the employee has been working for more than 50 hours,6 then for the first 40 hours, still calculated according to the conventional method;7 for the portion between 40-50 hours, hourly salary is calculated as 1.5 times times;8 and for more than 50 hours of the part, hourly salary is calculated at twice times. 9     Ten Input Format: One Enter only one row, including an integer and a real number, representing the working time and hourly salary, respectively.  A output Format: - The output has only one real number, which represents a weekly wage and retains 2 digits after the decimal point.  - */ the#include <stdio.h> - intMain () { -     inthour; -     DoubleAllprice,price; +scanf"%D%LF",&hour,&Price ); -     if(hour<= +){ +Allprice = hour*Price ; A}Else if(hour> +&& hour<= -){ atAllprice = +*price + (hour- +) *price*1.5; -}Else if(hour> -){ -Allprice = +*price +Ten*price*1.5+ (hour- -) *price*2; -     } -printf"%.2f", allprice); -}

C language · Salary Calculation

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.