<script>
function cal(){
var num1 = parseInt(document.getElementById("num_1").value);
var num2 = parseInt(document.getElementById("num_2").value);
var opeartor = document.getElementById("opeartor").value;
if(opeartor=='+')
{
var total = num1+num2;
document.getElementById("result").innerHTML="Your Addition is " + total;
}
if(opeartor=='-')
{
var total = num1-num2;
document.getElementById("result").innerHTML="Your Substration is " + total;
}
}
</script>
<input type = "text" id = "num_1" placeholder = "Enter Your First Number">
<input type = "text" id = "num_2" placeholder = "Enter Your Second Number">
<select id = "opeartor">
<option value = "+">+</option>
<option value = "-">-</option>
</select>
<input type = "button" onclick = "cal()" value = "Calculate">
<p id ="result"></p>
Choose the right course and start building your future with practical skills.
Learn HTML, CSS, JavaScript, and PHP to build modern, responsive websites and real-world projects.
Enroll Now See Full Details
Understand electronics basics with hands-on breadboard projects and circuit building techniques.
Enroll Now See Full Details
Step into AI with real-world applications, automation tools, and smart development techniques.
Enroll Now See Full Details