JavaScript Program to multiply of two numbers

Program

<!DOCTYPE html>
<html>
<head>
<title>Multiply Two Numbers</title>

<script> function calculateMul() { var a = document.getElementById("firstNum").value; var b = document.getElementById("secondNum").value; var mul = parseInt(a) * parseInt(b); document.getElementById("result").innerHTML = mul; } </script>

</head> <body> <h2>Multiply two numbers</h2> <label>Enter the value of a: </label><input type="number" id="firstNum" name="firstNum" /><br> <label>Enter the value of b: </label><input type="number" id="secondNum" name="secondNum" /><br> <button type="button" onClick="calculateMul()">Multiply</button> <p>Result: <span id="result" style="color: red;"></span></p> </body> </html>

Output

Multiply two numbers



Result: