<!DOCTYPE html> <html> <head> <title>Compound Annual Growth Rate Calculator</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> body { font-family: Arial, sans-serif; padding: 20px; } h1 { text-align: center; } form { display: flex; flex-direction: column; align-items: center; margin-top: 20px; } label { display: block; margin-bottom: 5px; font-weight: bold; } input[type="number"] { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid #ccc; border-radius: 5px; font-size: 16px; box-sizing: border-box; } button { background-color: #4CAF50; color: white; padding: 10px; border: none; border-radius: 5px; font-size: 16px; cursor: pointer; transition: background-color 0.3s ease; } button:hover { background-color: #3e8e41; } .result { margin-top: 20px; font-size: 18px; font-weight: bold; } </style> </head> <body> <h1>Compound Annual Growth Rate Calculator</h1> <form> <label for="starting-amount">Starting Amount:</label> <input type="number" id="starting-amount" placeholder="Enter starting amount" required> <label for="ending-amount">Ending Amount:</label> <input type="number" id="ending-amount" placeholder="Enter ending amount" required> <label for="years">Number of Years:</label> <input type="number" id="years" placeholder="Enter number of years" required> <button type="button" onclick="calculateCAGR()">Calculate CAGR</button> </form> <div class="result" id="result"></div> <script> function calculateCAGR() { var startingAmount = parseFloat(document.getElementById("starting-amount").value); var endingAmount = parseFloat(document.getElementById("ending-amount").value); var years = parseFloat(document.getElementById("years").value); var cagr = Math.pow((endingAmount / startingAmount), (1 / years)) - 1; var resultElement = document.getElementById("result"); resultElement.innerHTML = "The Compound Annual Growth Rate is: " + (cagr * 100).toFixed(2) + "%"; } </script> </body> </html>
Discover a collection of free HTML tools to enhance your web development skills. Create amazing websites and boost your productivity with these valuable resources."
Sunday, May 7, 2023
100% Free Compound Annual Growth Rate Calculator Tool:
Subscribe to:
Post Comments (Atom)
100% Free Language Translator Tool: Easily Translate Language by Using this Tool
Language Translator Language Translator Source Language: Afrikaans Albanian Amharic ...
No comments:
Post a Comment