forked from swaaz/basicprograms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram-5.html
More file actions
47 lines (46 loc) · 1.23 KB
/
Copy pathprogram-5.html
File metadata and controls
47 lines (46 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<html>
<head>
<title>MATHEMATICAL OPERATIONS OF TWO NUMBERS</title>
<script type="text/javascript">
function add()
{
var a=document.getElementById("n1").value;
var b=document.getElementById("n2").value;
var c=parseInt(a)+parseInt(b);
document.getElementById("Results").value=c;
}
function sub()
{
var a=document.getElementById("n1").value;
var b=document.getElementById("n2").value;
var c=parseInt(a)-parseInt(b);
document.getElementById("Results").value=c;
}
function mul()
{
var a=document.getElementById("n1").value;
var b=document.getElementById("n2").value;
var c=parseInt(a)*parseInt(b);
document.getElementById("Results").value=c;
}
function div()
{
var a=document.getElementById("n1").value;
var b=document.getElementById("n2").value;
var c=parseInt(a)/parseInt(b);
document.getElementById("Results").value=c;
}
</script>
<body>
<form>
ENTER NUMBER1:<input type="text" id="n1" size="20"/><br>
ENTER NUMBER2:<input type="text" id="n2" size="20"/><br>
<input type="button" value="+" onclick="add()"/>
<input type="button" value="-" onclick="sub()"/>
<input type="button" value="*" onclick="mul()"/>
<input type="button" value="/" onclick="div()"/>
Reset:<input type="Reset" value="Reset"/>
Result:<input type="text" id="Results"/>
</form>
</body>
</html>