JavaScript Program to Add Two Numbers

JavaScript Program to Add Two Numbers Source Code
JavaScript Program to Add Two Numbers Source Code

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Add Two Number</title>
</head>

<body>

    <div class="container">
   
    <input id="input1" type="number" placeholder="Enter First Number">

    <input id="input2" type="number" placeholder="Enter Second Number">

    <button id="btn" onclick="btnc()">Add</button>

    <p id="result"></p>

</div>

    <script>
        function btnc(){
            let a = parseInt(document.getElementById("input1").value);

            let b = parseInt(document.getElementById("input2").value);

            let c = a+b;

            result.innerHTML = `${c}`

        }
    </script>
</body>
</html>

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.
NextGen Digital Welcome to WhatsApp chat
Howdy! How can we help you today?
Type here...