-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path3.html
More file actions
46 lines (45 loc) · 1.17 KB
/
Copy path3.html
File metadata and controls
46 lines (45 loc) · 1.17 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>3</title>
</head>
<body>
<script>
var a=prompt("введите строку с действием");
if(a){
if(a.indexOf('+')>-1){
var mass=a.split("+");
var answer=parseInt(mass[0])+parseInt(mass[1]);
document.write(answer);
}
else {
if (a.indexOf('-')>-1) {
var mass=a.split("-");
document.write( parseInt(mass[0])-parseInt(mass[1]));
// document.write(answer);
}
else {
if (a.indexOf('*')>-1) {
var mass=a.split('*');
var answer=parseInt(mass[0])*parseInt(mass[1]);
document.write(answer);
}
else {
if (a.indexOf('/')>-1) {
var mass=a.split('/');
if(mass[1]!=0) {
var answer = parseInt(mass[0]) / parseInt(mass[1]);
document.write(answer);
}
else{
document.write("Деление на 0!");
}
}
}
}
}
}
</script>
</body>
</html>