Basit düzeyde hesap makinesi html kodu.
HTML:
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hesap Makinesi</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f4f4f4;
}
.calculator {
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.1);
}
input[type="button"], input[type="text"] {
width: 60px;
height: 60px;
font-size: 24px;
margin: 5px;
}
input[type="text"] {
text-align: right;
}
.result {
width: 100%;
height: 60px;
}
</style>
</head>
<body>
<div class="calculator">
<form name="calc">
<input type="text" class="result" name="result" readonly>
<br>
<input type="button" value="1" onclick="calc.result.value += '1'">
<input type="button" value="2" onclick="calc.result.value += '2'">
<input type="button" value="3" onclick="calc.result.value += '3'">
<input type="button" value="+" onclick="calc.result.value += '+'">
<br>
<input type="button" value="4" onclick="calc.result.value += '4'">
<input type="button" value="5" onclick="calc.result.value += '5'">
<input type="button" value="6" onclick="calc.result.value += '6'">
<input type="button" value="-" onclick="calc.result.value += '-'">
<br>
<input type="button" value="7" onclick="calc.result.value += '7'">
<input type="button" value="8" onclick="calc.result.value += '8'">
<input type="button" value="9" onclick="calc.result.value += '9'">
<input type="button" value="*" onclick="calc.result.value += '*'">
<br>
<input type="button" value="C" onclick="calc.result.value = ''">
<input type="button" value="0" onclick="calc.result.value += '0'">
<input type="button" value="=" onclick="calc.result.value = eval(calc.result.value)">
<input type="button" value="/" onclick="calc.result.value += '/'">
</form>
</div>
</body>
</html>