#outer { width: 90%; max-width: 600px; background: #efefef; text-align: center; margin: 0 auto; font-weight: 500; padding: 10px; radius: 5px; } #cover { border: 2px solid #111; padding: 15px 0 } .main { table-layout: fixed; width: 94%; border: 0; border-collapse: collapse; margin: 0 auto; } .main td { padding: 0 8px; vertical-align: middle; text-align: left; border: 0; font: 500 16px arial } .main input { width: 100%; border: 1px solid #ccc; margin: 2px 0; padding: 0 2%; height: 22px; text-align: right; font-weight: 400; font-size: 14px; } .main select { width: 100%; border: 1px solid #ccc; margin: 2px 0; background: #fff; height: 22px; font-weight: 400; font-size: 14px; } .main button { width: 100%; font-weight: 500; margin: 3px 0; } Interest Calculator Principal Amount Monthly Interest Rate Period (months) Submit Total Amount 3138.43

function interest() { var principal = document.getElementById('principal').value; var rate = document.getElementById('rate').value; var crate = 1; var time = document.getElementById('time').value; time = time * 12; var irate = rate / crate; document.getElementById('inttamt').innerHTML = ((principal * 1) + Math.round((document.getElementById('principal').value * Math.pow((1 + irate / 100), (time / 12 * crate)) * 1 - principal * 1) * 100) / 100).toFixed(2); }