Summation Calculator
<h2>Summation Calculator</h2>
<input type="number" id="number1" placeholder="Enter first number">
<input type="number" id="number2" placeholder="Enter second number">
<button onclick="calculateSum()">Calculate Sum</button>
<p id="result"></p>
<script>
function calculateSum() {
let num1 = parseFloat(document.getElementById("number1").value);
let num2 = parseFloat(document.getElementById("number2").value);
if(isNaN(num1) || isNaN(num2)) {
document.getElementById("result").innerText = "Please enter valid numbers.";
return;
}
let sum = num1 + num2;
document.getElementById("result").innerText = "Result: " + sum;
}
</script>