JavaScript program to Add Two Numbers Provided by User

Write a JavaScript program to add two numbers provided by user



Source Code
<html>
<head>
    <title>Sum of two numbers</title>
</head>
<body>
    <script>
        var a = parseInt(prompt("Enter the value of a", "0"));
        var b = parseInt(prompt("Enter the value of b", "0"));
        var sum = a + b;
        document.write("<br>Value of a = " + a);
        document.write("<br>Value of b = " + b);
        document.write("<br>Addition of a & b = " + sum);
    </script>
</body>
</html>
Output