How to Calculate Growth Rate in Gdp

GDP Growth Rate Calculator

This calculator helps you determine the percentage change in a country's Gross Domestic Product (GDP) over a specific period. GDP represents the total monetary value of all the finished goods and services produced within a country's borders in a specific time frame.

.gdp-growth-calculator { font-family: sans-serif; border: 1px solid #ccc; padding: 20px; border-radius: 8px; max-width: 400px; margin: 20px auto; } .gdp-growth-calculator h2 { text-align: center; margin-bottom: 20px; } .input-section { margin-bottom: 15px; } .input-section label { display: block; margin-bottom: 5px; font-weight: bold; } .input-section input { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; /* Ensures padding doesn't affect width */ } button { width: 100%; padding: 10px; background-color: #007bff; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 16px; } button:hover { background-color: #0056b3; } #result { margin-top: 20px; padding: 15px; background-color: #e9ecef; border: 1px solid #ced4da; border-radius: 4px; text-align: center; font-size: 18px; font-weight: bold; } function calculateGdpGrowth() { var currentGdp = parseFloat(document.getElementById("currentGdp").value); var previousGdp = parseFloat(document.getElementById("previousGdp").value); var resultDiv = document.getElementById("result"); if (isNaN(currentGdp) || isNaN(previousGdp) || previousGdp === 0) { resultDiv.textContent = "Please enter valid numbers for both GDP values, and ensure the previous GDP is not zero."; return; } // Formula for GDP Growth Rate: ((Current GDP – Previous GDP) / Previous GDP) * 100 var growthRate = ((currentGdp – previousGdp) / previousGdp) * 100; resultDiv.textContent = "GDP Growth Rate: " + growthRate.toFixed(2) + "%"; }

Leave a Comment