<!DOCTYPE html>
<html>
<head>
<title>EMI Calculator</title>
<script>
function calculateEMI() {
var p = document.getElementById("principal").value;
var r = document.getElementById("interest").value / 100 / 12;
var t = document.getElementById("tenure").value;
var emi = (p * r * Math.pow(1 + r, t)) / (Math.pow(1 + r, t) - 1);
document.getElementById("emi").value = emi.toFixed(2);
}
</script>
</head>
<body>
<h1>EMI Calculator</h1>
<form>
Principal: <input type="text" id="principal" /><br><br>
Interest Rate (%): <input type="text" id="interest" /><br><br>
Tenure (in months): <input type="text" id="tenure" /><br><br>
<input type="button" value="Calculate EMI" onclick="calculateEMI()" /><br><br>
EMI: <input type="text" id="emi" disabled="disabled" />
</form>
</body>
</html>
Comments
Post a Comment