-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
94 lines (79 loc) · 2.27 KB
/
index.html
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>CALCULATOR</title>
<style>
*{
margin: 0;
padding: 0;
background-color: #6cff65;
}
input{
text-align: center;
justify-content: center;
padding: 10px;
margin: 10px;
text-transform: uppercase;
width: 200px;
display: block;
background-color: black;
color: white;
transition: 2s;
}
input:hover{
color: yellow;
border-radius: 45px;
}
h1{
text-align: center;
justify-content: center;
color: darkgreen;
}
</style>
</head>
<body>
<h1>CALCULATOR</h1>
<form name="cal">
<input type="number" name="n1" placeholder="enter first number">
<input type="number" name="n2" placeholder="enter second number">
<input type="button" name="add" value="addition" onclick="addd()">
<input type="button" name="sub" value="subraction" onclick="subbb()">
<input type="button" name="mul" value="multiplication" onclick="mull()">
<input type="button" name="div" value="division" onclick="divv()">
<input type="reset" value="clear all">
</form>
<script>
var x=0;
var y =0;
var z=0;
function addd(){
x =parseInt(cal.n1.value);
y =parseInt(cal.n2.value);
z=x+y;
alert( "answer is"+z);
}
function subbb(){
x =parseInt(cal.n1.value);
y =parseInt(cal.n2.value);
z=x-y;
alert( "answer is"+z);
}
function mull(){
x =parseInt(cal.n1.value);
y =parseInt(cal.n2.value);
z=x*y;
alert("answer is"+z);
}
function divv(){
x =parseInt(cal.n1.value);
y =parseInt(cal.n2.value);
z =x/y;
alert("answer is"+z);
}
</script>
</body>
</html>