<h1>Calculator</h1>
<input type="number" id="num1" placeholder="First number">
<input type="number" id="num2" placeholder="Second number">
<input type="number" id="result" placeholder="Result">
<br />
<button type="button" onclick="plus()">+</button>
<button type="button" onclick="minus()">-</button>
<button type="button" onclick="product()">*</button>
<button type="button" onclick="divide()">/</button>
<script>
result=0.;
// Function to perform the calculation
function plus() {
z=0.;x=0.;y=0.;
x = document.getElementById('num1').value;
y = document.getElementById('num2').value;
z = Number(x) + Number(y);
// Display the result
document.getElementById('result').value = z;
}
function minus() {
result=0.;x=0.;y=0.;
x = document.getElementById('num1').value;
y = document.getElementById('num2').value;
result = x - y;
// Display the result
document.getElementById('result').value = result;
}
function product() {
result=0.;x=0.;y=0.;
x = document.getElementById('num1').value;
y = document.getElementById('num2').value;
result = x * y;
// Display the result
document.getElementById('result').value = result;
}
function divide() {
result=0.;x=0.;y=0.;
x = document.getElementById('num1').value;
y = document.getElementById('num2').value;
result = x / y;
// Display the result
document.getElementById('result').value = result;
}
</script>
Computer Methods in Science Course
Subscribe to:
Post Comments (Atom)
NaCl.xyz Generator with Interactive 3D Visualization
NaCl.xyz Generator with Interactive 3D Visualization NaCl.xyz Generator with Interactive 3D Visualization ...
-
In mathematics, Pascal's triangle is a triangular array of the binomial coefficients Coasters (Set of 4) $13.91 #MOVING #EYE #ILLUSION #...
-
Cognitive Science Hexagon - научные направления, которые способствовали зарождению когнитивной наукиActive T-Shirt $25.00 Baseball ¾ Sleeve T-Shirt $25.20 Classic T-Shirt $19.90 Graphic T-Shirt $28.22 Lightweight Hoodie $34.85 Lightweight S...
-
Get my art printed on awesome products. Support me at Redbubble Unit #circle #angles. #Trigonometry, #Math Formulas, Geometry Formu...
No comments:
Post a Comment