Simple interest Calculator

M2-R5.1 · Chapter 6: JavaScript and Angular JS · 1 min read

Question make a simple Interest calculator using Js

Source Code -

<!DOCTYPE html>
<html>
<head>

    <title></title>
    <style>
        div{
            background: violet;
            color: black;
            text-align: center;
            margin-top: 25px;
            padding-top: 10px;
            width: 400px;
        }        
    </style>
</head>
<body>
    <center>
<div>
    <h1>Simple Interest Calculator</h1>
    Principle: <input type="text" id="t1"><br><br>

    Rate : <input type="text" id="t2"><br><br>

    Time : <input type="text" id="t3"><br><br>

    <button onclick="si()">clickk</button>

  <h2>Simple interest -<span id="r"></span></h2><br><br>   
</div></center>
    <script>

        function si() {
            var p=parseInt(document.getElementById("t1").value);
            var r=parseInt(document.getElementById("t2").value);
            var t=parseInt(document.getElementById("t3").value);

            var s=(p*r*t)/100;
            document.getElementById("r").innerHTML= s;
        }

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