Objective: S/W Requirement H/W Requirement
Objective: S/W Requirement H/W Requirement
--------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
<html>
<head>
<title>Add</title>
<script language="javascript">
function add(){
var a=parseInt(document.f1.t1.value);
var b=parseInt(document.f1.t2.value);
document.f1.r.value=eval(a+b);
</script>
</head>
<body bgcolor=orange>
<form name="f1">
</form>
</body>
</html>
Output:
------------------------------------------------------------------------------------------------------------------------------------------
11. Write a program in HTML to perform addition, subtraction, multiplication and division on two
numbers.
-------------------------------------------------------------------------------------------------------------------------------
Objective: To write a program in HTML to perform addition, subtraction, multiplication and division on
two numbers.
<html>
<head>
<title>Arithmetic Operations</title>
function add()
var x=parseInt(document.o.t1.value);
var y=parseInt(document.o.t2.value);
var z=x+y;
document.o.t3.value=z;
function sub()
var x=parseInt(document.o.t4.value);
var y=parseInt(document.o.t5.value);
var z=x-y;
document.o.t6.value=z;
function mul()
var x=parseInt(document.o.t7.value);
var y=parseInt(document.o.t8.value);
var z=x*y;
document.o.t9.value=z;
function div()
var x=parseInt(document.o.t10.value);
var y=parseInt(document.o.t11.value);
var z=x/y;
document.o.t12.value=z;
</Script>
</head>
<body bgcolor=violet>
<form name="o">
<br>
<br>
<br>
<br>
</form>
</body>
</html>
Output:
Conclusion: We understand that how to perform addition, subtraction, multiplication and division on two
numbers in HTML.
------------------------------------------------------------------------------------------------------------------------------------------
12. Write a program in HTML design a calculator and perform operations using it.
-------------------------------------------------------------------------------------------------------------------------------
Objective: To write a program in HTML to design a calculator and perform operations using it.
<html>
<head>
<title>Calculator</title>
</head>
<body>
<center>
<form name="Cal">
<table border=4>
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</form>
</center>
</body>
</html>
Output:
Conclusion: We understand that how to design a calculator in HTML and perform operations using it.