/* Program to calculate the electric - bills */ /* Problem 6 */ #include #include main() { int unit_consumed,temp; float rate; float bill_amount; clrscr(); printf("Please enter the units consumed by customer : "); scanf("%d",&unit_consumed); if ((unit_consumed >= 0) && (unit_consumed <= 200)) bill_amount = unit_consumed * 0.50; else if (unit_consumed <= 400) { bill_amount = 100; temp = unit_consumed - 200; bill_amount += temp * 0.65; } else if (unit_consumed <= 600) { bill_amount = 270; temp = unit_consumed - 400; bill_amount += temp * 0.80; } else { bill_amount = 390; temp = unit_consumed - 600; bill_amount += temp * 1.0; } printf("\nThe amount to be paid, by the customer is Rs. %.2f",bill_amount); printf("\n\nPress any key to exit..."); getch(); }