main()
{
int units, custnum;
float charges;
printf("Enter CUSTOMER NO. and UNITS consumed\n");
scanf("%d %d", &custnum, &units);
if (units <= 200)
charges = 0.5 * units;
elseif (units <= 400)
charges = 100 + 0.65 * (units - 200); elseif (units <= 600)
charges = 230 + 0.8 * (units - 400);
else
charges = 390 + (units - 600);
printf("\n\nCustomer No: %d: Charges = %.2f\n",
custnum, charges);
}
Output
Enter CUSTOMER NO. and UNITS consumed 101 150
Customer No:101 Charges = 75.00
Enter CUSTOMER NO. and UNITS consumed 202 225
Customer No:202 Charges = 116.25
Enter CUSTOMER NO. and UNITS consumed 303 375
Customer No:303 Charges = 213.75
Enter CUSTOMER NO. and UNITS consumed 404 520
Customer No:404 Charges = 326.00
Enter CUSTOMER NO. and UNITS consumed 505 625
Customer No:505 Charges = 415.00