The nominal GDP growth rate measures the increase in a country's Gross Domestic Product (GDP) at current prices, without adjusting for inflation. It reflects both the increase in the quantity of goods and services produced and the change in their prices.
function calculateNominalGdpGrowth() {
var currentGdp = parseFloat(document.getElementById("currentGdp").value);
var previousGdp = document.getElementById("previousGdp").value;
var resultDiv = document.getElementById("result");
// Input validation
if (isNaN(currentGdp) || isNaN(previousGdp) || previousGdp <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for both GDP figures. The previous year's GDP must be greater than zero.";
return;
}
// Calculation: ((Current GDP – Previous GDP) / Previous GDP) * 100
var growthRate = ((currentGdp – previousGdp) / previousGdp) * 100;
resultDiv.innerHTML = "