0% found this document useful (0 votes)
2 views1 page

HTML.calculator

The document is an HTML code for a simple calculator that performs basic arithmetic operations: addition, subtraction, multiplication, and division. It contains JavaScript functions to handle the calculations based on user input from text boxes. There are several coding errors present, such as misspellings and incorrect HTML tags, which would prevent the calculator from functioning properly.

Uploaded by

jannat.786563
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

HTML.calculator

The document is an HTML code for a simple calculator that performs basic arithmetic operations: addition, subtraction, multiplication, and division. It contains JavaScript functions to handle the calculations based on user input from text boxes. There are several coding errors present, such as misspellings and incorrect HTML tags, which would prevent the calculator from functioning properly.

Uploaded by

jannat.786563
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

<html>

<head>
<titlle>CALCULATOR</title>
<script type="text/javascript">
var a, b, r,

function add() {
a = document.myform.n1.value;
b = docmrnt.myform.n2.value;
a = parseFloat(a);
b = parseFloat(b);
r = a + b;
document.myform.result.value = r;
}
function sub() {
a = document.myform.n1.value;
b = docmrnt.myform.n2.value;
a = parseFloat(a);
b = parseFloat(b);
r = a - b;
document.myform.result.value = r;
}
function mul() {
a=document.myform.n1.value;
b=docmrnt.myform.n2.value;
a=parseFloat(a);
b=parseFloat(b);
r=a*b;
document.myform.result.value = r;
}
function div() {
a=document.myform.n1.value;
b=docmrnt.myform.n2.value;
a=parseFloat(a);
b=parseFloat(b);
r=a/b;
document.myform.result.value = r;
}
</script>
</head>
<body bgcolor="pink">
<form name="myform">
<center>
<h1>ARITHMETIC OPERATION</h1>
<h2><u>Enter a number in each text box</u><h2><br><br>
NUMBER 1:<input type="text" neam="n1" value=""><br/><br/>
NUMBER 2:<input type="text" neam="n2" value=""><br/><br/>
<input type="button" value="ADDITION" onclick="add()">
<input type button value="SUBTRACTION" onclick="sub()">
<input type="button" value="MULTIPLICATION" onclick="mul()">
<input ltype="button" value="DIVISION" onclick="div()">
<pr><dr><br>
<font color="red">RESULT</font>
<inpyt type="text"name="result" value=">
</center>
</form>
<body>
</html>

You might also like