All Rounder Tools Blogger-Best blog for blogger: Compound Annual Growth rate calculator tool with colorful styling and all its features use any free library...

Sunday, September 22, 2024

Compound Annual Growth rate calculator tool with colorful styling and all its features use any free library...

 

CAGR Calculator

CAGR Calculator

body { font-family: Arial, sans-serif; background: linear-gradient(135deg, #f0f0f0, #e0e0e0); color: #333; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .container { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 0 15px rgba(0, 0, 0, 0.2); text-align: center; width: 300px; } h1 { color: #4a4a4a; } .input-group { margin: 10px 0; } label { display: block; margin-bottom: 5px; } input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 16px; } button { background-color: #007BFF; color: white; padding: 10px 15px; border: none; border-radius: 4px; cursor: pointer; margin-top: 10px; transition: background-color 0.3s; font-size: 16px; } button:hover { background-color: #0056b3; } .result { margin-top: 20px; } #output { margin-top: 10px; padding: 10px; border: 1px solid #ddd; border-radius: 4px; background: #f9f9f9; } document.getElementById('calculateButton').addEventListener('click', function() { const initialValue = parseFloat(document.getElementById('initialValue').value); const finalValue = parseFloat(document.getElementById('finalValue').value); const years = parseFloat(document.getElementById('years').value); const output = document.getElementById('output'); if (isNaN(initialValue) || isNaN(finalValue) || isNaN(years) || years <= 0) { output.textContent = "Please enter valid values."; return; } const cagr = ((finalValue / initialValue) ** (1 / years) - 1) * 100; output.textContent = `CAGR: ${cagr.toFixed(2)}%`; });

No comments:

Post a Comment