Calculator for Engineering Students

Engineering Students Calculator

Use this calculator to simplify various engineering-related calculations, from formulas to conversions.

Addition Subtraction Multiplication Division

function performCalculation() { var value1 = parseFloat(document.getElementById(‘value1’).value); var value2 = parseFloat(document.getElementById(‘value2’).value); var operation = document.getElementById(‘operation’).value; var result; if (isNaN(value1) || isNaN(value2)) { alert(“Please enter valid numbers for both values.”); return; } switch (operation) { case ‘add’: result = value1 + value2; break; case ‘subtract’: result = value1 – value2; break; case ‘multiply’: result = value1 * value2; break; case ‘divide’: if (value2 === 0) { alert(“Cannot divide by zero.”); return; } result = value1 / value2; break; } document.getElementById(‘result’).innerText = “Result: ” + result; }

Leave a Reply

Your email address will not be published. Required fields are marked *