bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

P025.c (1131B)


      1 /*
      2  * Author: Amit Dutta (amitdutta4255@gmail.com) | Date: 12 Dec 2025
      3  * Repo: https://github.com/notamitgamer/bsc
      4  * License: MIT
      5  */
      6 
      7 /* WAP to input the electricity unit consumed and calculate the total
      8 bill amount according to the given condition :
      9     for 1st 50 unit            Rs. 0.50 per unit
     10     next 100 unit              Rs. 0.75 per unit
     11     next 100 unit              Rs. 1.20 per unit
     12     above 250 unit             Rs. 1.50 per unit
     13 And additional charge of 20 percent is added to the bill.
     14 */
     15 // This code has not been compiled. 
     16 // If you find any issues, please create a new issue on GitHub regarding them.
     17 
     18 #include <stdio.h>
     19 int main()
     20 {
     21     double unit, amt;
     22     printf("Enter the electricity consp(unit) : ");
     23     scanf("%lf", &amt);
     24     if (unit <= 50)
     25         amt = unit * 0.50;
     26     else if (unit > 50 && unit <= 50)
     27         amt = 25 + ((unit - 50) * 0.75);
     28     else if (unit > 150 && unit <= 250)
     29         amt = 25 + 75 + ((unit - 150) * 1.20);
     30     else if (unit > 250)
     31         amt = 25 + 75 + 120 + ((unit - 250) * 1.50);
     32     amt = amt * 1.20;
     33     printf("\nAmount to be paid : %g", amt);
     34     return 0;
     35 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror