Set 69 Practical Question

⭐ Q19 – Simple Interest Calculator (JavaScript)

Example Code (Read Only):


<!DOCTYPE html>
<html>
<head><title>Simple Interest</title></head>
<body>

<h2>Simple Interest Calculator</h2>

Principal: <input id="p"><br><br>
Rate: <input id="r"><br><br>
Years: <input id="t"><br><br>

<button onclick="calc()">OK</button>

<script>
function calc(){
    let p = document.getElementById("p").value;
    let r = document.getElementById("r").value;
    let t = document.getElementById("t").value;

    let si = (p * r * t) / 100;
    alert("Simple Interest = " + si);
}
</script>

</body>
</html>

Write Your HTML / JavaScript Code