Thursday, 25 April 2013

marks calculator


<html>
<head>

</head>
<body>

<center><h1>Marks Calculation</h1></center>
<script>
<!--
    var n,sum,sub,mark,out,per,tot,res,i,d;
    p=0;
    n=0;
    mark=0;
    out=0;
    tot=0;
    sum=0;
    per=0;
    i=1;

    n=parseInt(prompt("Enter the no. of subject for  you  to see the result:"));
    while(i<=n)
    {
        sub=prompt("enter the subject name:");
        document.write("enter the subject name:");
        document.write(sub);
        mark=parseInt(prompt("enter the marks obtained:"));
        document.write(" marks obtained:");
        document.write(mark);
        out=parseInt(prompt("enter the marks out off:"));
        document.write(" marks out off:");
        document.write(out);
        document.write("&lt;br&gt;");
        i++;
        sum=sum+mark;
        tot=tot+out;
    }
    document.write("TOTAL:");
    document.write(tot);
    document.write("TOTAL MARKS OBTAINED:");
    document.write(sum);
    per=parseFloat(sum/tot*100);
    document.write("PERCENTAGE OBTAINED:");
    document.write(per);

-->
</script>
</body>
</html>

No comments:

Post a Comment