Java Script program to add, subtraction,multiplication, division and modulus of two Numbers




<html>

<head>

<title> Java Script program to add, subtraction,multiplicaion and division of two Numbers</title>

<script language="javascript">

function math(fnm)

{

a=parseInt(fnm.t1.value)

b=parseInt(fnm.t2.value)


fnm.t3.value=a+b

fnm.t4.value=a-b

fnm.t5.value=a*b

fnm.t6.value=a/b

fnm.t7.value=a%b

}

</script>

</head>

<body>

<form>

<br>

<b>Enter First Number : </b>

<input type="text" name="t1">

<br><br>

<b>Enter Second Number</b>

<input type="text"name="t2">

<br><br>

<input type="button"name="b1"value="Calculate" onclick="math(form)">

<br>

<b>Addition of Two Numbers</b>

<input type="text" name="t3">

<br><br>

<b>Subtraction of Two Numbers</b>

<input type="text" name="t4">

<br><br>

<br>

<b>Multiplication of Two Numbers</b>

<input type="text" name="t5">

<br>

<br>

<b>Division of Two Numbers</b>

<input type="text" name="t6">

<br>

<br>


<br>

<b>Modulus of Two Numbers</b>

<input type="text" name="t7">

<br>

<br>

</form>

</body>

</html>

Output:





50 views1 comment

Recent Posts

See All

Java Script program to find simple interest

<html> <head> <title> form event</title> <script language="javascript"> function si(fnm) { P=fnm.t1.value R=fnm.t2.value T=fnm.t3.value fnm.t4.value=(P*R*T)/100 } </script> </head> <body> <form> <br>

If else if statement in Java Script

If Statement: If statement is execute when condition is true. If condition is not satisfied then statement is not execute. It means we get result when condition is satisfied and condition is not satis