-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path006 DortIslem.html
66 lines (58 loc) · 2.18 KB
/
006 DortIslem.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JS ile Toplama</title>
<style>
#sonuc{
background-color: orange; color:white; font-weight: bold;
}
</style>
<script>
function bolumHesapla(){
let s1, s2, bolum;
s1=parseInt(document.getElementById("sayi1").value);
s2=parseInt(document.getElementById("sayi2").value);
if(s2!=0){
bolum=s1/s2;
document.getElementById("sonuc").innerHTML="Bölüm :"+bolum;
} else{
document.getElementById("sonuc").innerHTML="Sıfıra bölünemez";
}
}
function toplamHesapla(){
let s1, s2, toplam;
s1=parseInt(document.getElementById("sayi1").value);
s2=parseInt(document.getElementById("sayi2").value);
toplam=s1+s2;
document.getElementById("sonuc").innerHTML="Toplam :"+toplam;
}
function cikarHesapla(){
let s1, s2, cikarim;
s1=parseInt(document.getElementById("sayi1").value);
s2=parseInt(document.getElementById("sayi2").value);
cikarim=s1-s2;
document.getElementById("sonuc").innerHTML="Çıkarım :"+cikarim;
}
function carpHesapla(){
let s1, s2, carpim;
s1=parseInt(document.getElementById("sayi1").value);
s2=parseInt(document.getElementById("sayi2").value);
carpim=s1*s2;
document.getElementById("sonuc").innerHTML="Çarpim :"+carpim;
}
</script>
</head>
<body>
<label for="">Sayı 1:</label>
<input type="text" id="sayi1"> <br>
<label for="">Sayı 2:</label>
<input type="text" id="sayi2"> <br>
<div id="sonuc"></div> <br>
<button onclick="toplamHesapla()">Topla</button>
<button onclick="carpHesapla()">Çarpım</button>
<button onclick="bolumHesapla()">Bölüm</button>
<button onclick="cikarHesapla()">Çıkarım</button>
</body>
</html>