Calculation of per unit of Electricity
<p>I'm trying to build a electrical units calculator. I have developed one but I am not satisfied with my code. I am here to ask you guys is there any other way to develop this calculator. </p>

<p>Following is my code :</p>

<p><strong>HTML</strong></p>

<pre><code>&lt;input name="" type="text" value="" onblur="check()" id="bill" /&gt;
</code></pre>

<p><strong>SCRIPT</strong></p>

<pre><code>&lt;script&gt;
    function check()
    {
    var a=0,b=0,c=0;
    var tot = 0;
    var tot1=0;
    var tot2=0;
    var tot3=0;

    var a = document.getElementById('bill').value;

    if(a&gt;200)
    {
        b = a - 200;
        alert('b is: '+b);
        if(b&gt;200)
        {
        c= b-200;
        alert('c is: '+c);
        tot1 = 200*4;
        tot2 = 200*5;
        tot3 = c*6;
        tot = tot1 + tot2 + tot3;
        alert(tot);
        }
        else
        {

        tot1 = 200*4;
        tot2 = b*5;
        tot3 = c*6;
        tot = tot1 + tot2 + tot3;
        alert(tot);

        }
    }
    else
    {
        tot = a*4;
        alert(tot);

    }
    }

&lt;/script&gt;
</code></pre>

<p>Please help me friends..:)</p>
