Compound Annual Growth Rate Calculator

Sure, here's an example of a responsive Compound Annual Growth Rate (CAGR) calculator using HTML, CSS, and JavaScript:https://toolsforeveryone372.blogspot.com/2023/03/html-with-js-write-complete-respons HTML code: html Copy code CAGR Calculator

CAGR Calculator

Baby care products CSS code: css Copy code .container { margin: 0 auto; max-width: 600px; padding: 20px; } h1 { text-align: center; } form { display: flex; flex-direction: column; } label { margin-bottom: 10px; } input { padding: 10px; margin-bottom: 20px; } button { padding: 10px; background-color: #4caf50; color: #fff; border: none; border-radius: 5px; cursor: pointer; } button:hover { background-color: #3e8e41; } #result { margin-top: 20px; } JavaScript code: javascript Copy code function calculate() { var initialAmount = document.getElementById("initial-amount").value; var finalAmount = document.getElementById("final-amount").value; var years = document.getElementById("years").value; var cagr = (Math.pow(finalAmount / initialAmount, 1 / years) - 1) * 100; var result = document.getElementById("result"); result.innerHTML = "CAGR: " + cagr.toFixed(2) + "%"; } This code will create a simple CAGR calculator that takes in an initial amount, final amount, and the number of years, and calculates the CAGR using the formula (finalAmount / initialAmount)^(1/years) - 1, and displays the result on the page. The CSS code is used to style the calculator and make it responsive

Comments

Popular Posts