Code:
<!DOCTYPE html>
<html>
<head>
<title>Basic Calculator Layout</title>
</head>
<body>
<h1>Basic Calculator</h1>
<!-- Display Screen -->
<input type="text" id="display" name="display" readonly><br><br>
<!-- Row 1: Number and Operation Buttons -->
<input type="button" value="7">
<input type="button" value="8">
<input type="button" value="9">
<input type="button" value="/"><br><br>
<!-- Row 2: Number and Operation Buttons -->
<input type="button" value="4">
<input type="button" value="5">
<input type="button" value="6">
<input type="button" value="*"><br><br>
<!-- Row 3: Number and Operation Buttons -->
<input type="button" value="1">
<input type="button" value="2">
<input type="button" value="3">
<input type="button" value="-"><br><br>
<!-- Row 4: Number and Operation Buttons -->
<input type="button" value="0">
<input type="button" value=".">
<input type="button" value="C">
<input type="button" value="+"><br><br>
<!-- Equal Button -->
<input type="button" value="=">
</body>
</html>
Explanation:
Display Screen:
<input type="text">
) at the top displays the numbers and operations. It's set to readonly
to prevent direct input.Buttons:
0-9
are arranged in a grid.+
, -
, *
, /
) are also added as buttons at the end of each row of numbers.=
button (for result) is placed at the bottom.C
button is for clearing the display, and .
is for decimal points.This structure creates a calculator UI with a mix of number and operation buttons in rows, simulating the layout of a real calculator.
Paramwebinfo,Raja talab Pandri, Raipur,Chhattisgarh India
8770447379
Info@paramclasses.in
Copyright © Paramwebinfo Academy.All Rights Reserved
Designed by PARAMWEBINFO