You are on page 1of 3

ELECTRICITY BILL CALCULATION

CODING:

<html>
<head>Electricity bill calculation page</head>
<br></br>
  <body>
      <script>
        var units=parseInt(prompt("Enter the total number of units consumed"))
        var bill=0
        if(units>100)
    {
          bill=100*10
          units=units-100
          if(units>100)
     {
            bill=bill+100*15
            units=units-100
            bill=bill+units*20
            document.write("Total Electricity bill = "+bill)
     }
          else
     {
            document.write("Total Electricity bill = "+(bill+units*15))
     }
    }
        else
    {
          document.write("Total Electricity bill = "+(units*10))
    }
      </script>
<p> Priyadharshni E B 19EER067</p>
  </body>
</html>
OUTPUT:

You might also like