C language _ Use if ' Else statement to solve bonus issue

Source: Internet
Author: User

#include <stdio.h>#include<stdlib.h>/*the bonuses awarded by the Enterprise are based on the profit Commission and the rules are as follows: Profit (I) is less than or equal to 100,000 yuan, bonus can be raised 10%, profit is above 100,000 yuan, below 200,000 yuan, part of less than 100,000 yuan by 10% commission, higher than 100,000 yuan portion, Cocoa Commission 7.5% Between 200,000 and 400,000, the portion above 200,000 yuan can be 5%, 400,000 to 600,000 is higher than 400,000 yuan, can be a commission of 3%, 600,000 to 1 million, the portion above 600,000 yuan, can be a commission of 1.5%, higher than 1 million yuan, the portion of more than 1 million yuan by 1% Commission. Enter the current month profit I from the keyboard, the total bonus should be issued? */intMain () {Long intgain; intPrize1, Prize2, Prize4, Prize6, prize10, prize =0; Puts ("*************************************"); Puts ("* The program would solve *"); Puts ("* The problem of prize distribution *"); Puts ("*************************************"); Puts ("Please input the num of gain:"); scanf_s ("%ld", &gain); Prize1=100000*0.1; Prize2= Prize1 +100000*0.075; Prize4= Prize2 +200000*0.05; Prize6= Prize4 +200000*0.03; Prize10= Prize6 +400000*0.015; if(Gain <=100000) Prize= gain*0.1; Else if(Gain <=200000) Prize= Prize1 + (Gain-100000)*0.075; Else if(Gain <=400000) Prize= Prize2 + (Gain-200000)*0.05; Else if(Gain <=600000) Prize= Prize4 + (Gain-400000)*0.03; Else if(Gain <=1000000) Prize= Prize6 + (Gain-600000)*0.015; ElsePrize= Prize10 + (Gain-1000000)*0.01; printf ("The Prize is:%d\n", prize); GetChar ();
System ("pause"); return 0;}

C language _ Use if ' Else statement to solve bonus issue

Related Article

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.