No.15 distribution of funds in the district

Source: Internet
Author: User

#include "stdio.h"
#include "Stdlib.h"
int main ()
{float Li,jiang;
printf ("Input li:\n");
scanf ("%f", &li);
while (li<=0)
{printf ("Data wrong!\n"); System ("pause"); return 0;}
if (li<=10) Jiang=0.1*li;
else if (li>=10&&li<=20) jiang=0.1*10+0.075* (li-10);
else if (li>=20&&li<=40) jiang=0.1*10+0.075*10+0.05* (li-20);
else if (li>=40&&li<=60) jiang=0.1*10+0.075*10+0.05*20+0.03* (li-40);
else if (li>=60&&li<=100) jiang=0.1*10+0.075*10+0.05*20+0.03*20+0.015* (li-60);
else jiang=0.1*10+0.075*10+0.05*20+0.03*20+0.015*40+0.01* (li-100);
printf ("Jiang is:%.3f", Jiang);
System ("pause");
}

1. Each phase of the constant funds can be named J1,J2,J3, etc.

Only add <= after 2.else

3. Notice the difference in usage of long,float,int,double, review the meaning of%8.3f

No.15 distribution of funds in the district

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.