Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
1.2 kB
0
Indexable
Never
<!DOCTYPE html>
<html> 
<head>
<meta charset=utf-8 />
<title>JavaScript program to calculate multiplication and division of two numbers </title>
<style type="text/css">
body {margin: 30px;}
</style> 
<script type="text/javascript">
function multiplyBy()
{
 num1 = document.getElementById("firstNumber").value;
 num2 = document.getElementById("secondNumber").value;
 document.getElementById("product").value = num1 * num2;
}
function divideBy() 
num1 = document.getElementById("firstNumber").value;

 num2 = document.getElementById("secondNumber").value;

document.getElementById("division").value = num1 / num2;
}
</script>
</head>
<body>
<p>Product and Quotient of Given Two Numbers</p>
<form>
1st Number : <input type="text" id="firstNumber" /><br><br>
2nd Number: <input type="text" id="secondNumber" /><br><br>
<label>Product of two numbers:
 <input type="text" id="product"/></label><br><br>
<label>Product of two numbers:
 <input type="text" id="division"/></label><br><br>
<input type="button" onClick="multiplyBy()" value="product" />
<input type="button" onClick="divideBy()" value="quotient" />
</form>
</body>
</html>
Leave a Comment