P025.c (995B)
1 /* WAP to input the electricity unit consumed and calculate the total 2 bill amount according to the given condition : 3 for 1st 50 unit Rs. 0.50 per unit 4 next 100 unit Rs. 0.75 per unit 5 next 100 unit Rs. 1.20 per unit 6 above 250 unit Rs. 1.50 per unit 7 And additional charge of 20 percent is added to the bill. 8 */ 9 // This code has not been compiled. 10 // If you find any issues, please create a new issue on GitHub regarding them. 11 12 #include <stdio.h> 13 int main() 14 { 15 double unit, amt; 16 printf("Enter the electricity consp(unit) : "); 17 scanf("%lf", &amt); 18 if (unit <= 50) 19 amt = unit * 0.50; 20 else if (unit > 50 && unit <= 50) 21 amt = 25 + ((unit - 50) * 0.75); 22 else if (unit > 150 && unit <= 250) 23 amt = 25 + 75 + ((unit - 150) * 1.20); 24 else if (unit > 250) 25 amt = 25 + 75 + 120 + ((unit - 250) * 1.50); 26 amt = amt * 1.20; 27 printf("\nAmount to be paid : %g", amt); 28 return 0; 29 }