The Rate of Natural Increase (RNI) is a demographic measure that represents the difference between the birth rate and the death rate in a population over a specific period, usually a year. It indicates whether a population is growing or declining due to births and deaths alone, excluding migration.
Result:
#natural-increase-calculator {
font-family: sans-serif;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
max-width: 500px;
margin: 20px auto;
background-color: #f9f9f9;
}
.input-section {
margin-bottom: 15px;
}
.input-section label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
.input-section input[type="number"] {
width: calc(100% – 12px);
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
}
button {
background-color: #4CAF50;
color: white;
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #45a049;
}
#result {
margin-top: 20px;
padding: 15px;
border: 1px solid #ddd;
border-radius: 4px;
background-color: #fff;
}
#result h3 {
margin-top: 0;
}
function calculateNaturalIncrease() {
var birthRateInput = document.getElementById("birthRate");
var deathRateInput = document.getElementById("deathRate");
var rniResultDisplay = document.getElementById("rniResult");
var interpretationDisplay = document.getElementById("interpretation");
var birthRate = parseFloat(birthRateInput.value);
var deathRate = parseFloat(deathRateInput.value);
if (isNaN(birthRate) || isNaN(deathRate)) {
rniResultDisplay.textContent = "Please enter valid numbers for both rates.";
interpretationDisplay.textContent = "";
return;
}
if (birthRate < 0 || deathRate 0) {
interpretation = "The population is growing due to births exceeding deaths.";
} else if (rni < 0) {
interpretation = "The population is declining due to deaths exceeding births.";
} else {
interpretation = "The population is stable, with births equaling deaths.";
}
interpretationDisplay.textContent = interpretation;
}