Use this tool to quickly perform calculations on your Android phone, with no need for additional apps or downloads.
Add
Subtract
Multiply
Divide
Result:
function calculate() {
var val1 = parseFloat(document.getElementById(“inputValue1”).value);
var val2 = parseFloat(document.getElementById(“inputValue2”).value);
var operation = document.getElementById(“operation”).value;
var result;
if (isNaN(val1) || isNaN(val2)) {
alert(“Please enter valid numbers!”);
return;
}
switch (operation) {
case “add”:
result = val1 + val2;
break;
case “subtract”:
result = val1 – val2;
break;
case “multiply”:
result = val1 * val2;
break;
case “divide”:
if (val2 === 0) {
alert(“Cannot divide by zero!”);
return;
}
result = val1 / val2;
break;
}
document.getElementById(“result”).value = result.toFixed(2);
}