<!DOCTYPE html>
<html>
<head>
<title>EMI Calculator</title>
</head>
<body>
<h1>EMI Calculator</h1>
<form>
<label for="principal">Loan Amount:</label>
<input type="number" id="principal" name="principal" required><br><br>
<label for="rate">Interest Rate (% p.a.):</label>
<input type="number" id="rate" name="rate" required><br><br>
<label for="tenure">Loan Tenure (in months):</label>
<input type="number" id="tenure" name="tenure" required><br><br>
<button type="button" onclick="calculate()">Calculate EMI</button><br><br>
<label for="result">EMI per month:</label>
<input type="text" id="result" name="result" readonly>
</form>
<script>
function calculate() {
let principal = parseFloat(document.getElementById("principal").value);
let rate = parseFloat(document.getElementById("rate").value);
let tenure = parseInt(document.getElementById("tenure").value);
let monthly_rate = (rate/100) / 12;
let emi = (principal * monthly_rate * ((1 + monthly_rate) ** tenure)) / (((1 + monthly_rate) ** tenure) - 1);
document.getElementById("result").value = emi.toFixed(2);
}
</script>
</body>
</html>