Financial Calculator India

Financial Calculator India

function calculateEMI() { let principal = parseFloat(document.getElementById(‘principalAmount’).value); let rate = parseFloat(document.getElementById(‘rateOfInterest’).value) / 100 / 12; // Monthly rate let term = parseInt(document.getElementById(‘loanTerm’).value) * 12; // Loan term in months if (isNaN(principal) || isNaN(rate) || isNaN(term) || principal <= 0 || rate <= 0 || term <= 0) { alert("Please enter valid values."); return; } let emi = (principal * rate * Math.pow(1 + rate, term)) / (Math.pow(1 + rate, term) – 1); document.getElementById('emiAmount').value = emi.toFixed(2); } function resetForm() { document.getElementById('financialCalculatorForm').reset(); document.getElementById('emiAmount').value = ''; }

Leave a Reply

Your email address will not be published. Required fields are marked *