Skip to content

This basic calculator is a beginner-friendly web application designed to perform fundamental arithmetic operations such as addition, subtraction, multiplication, and division. It is implemented using HTML, CSS, and JavaScript to provide structure, styling, and interactivity, respectively.

Notifications You must be signed in to change notification settings

arjunlimboo/Basic-Calculator-using-HTML-CSS-JavaScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic Calculator

This project is a simple web-based calculator built using HTML, CSS, and JavaScript. It provides basic arithmetic operations and a user-friendly interface.

Features

Perform basic arithmetic operations: addition, subtraction, multiplication, and division.

Clear the input display with the C button.

Supports decimal input.

Interactive and responsive design.

Files in the Project

calculator.html

The main HTML file that structures the calculator.

Links the CSS for styling and JavaScript for functionality.

styles.css

Styles the calculator with a modern and clean design.

Includes flexbox and grid layouts for alignment and spacing.

script.js

Handles calculator logic and user interactions.

Functions include appending values to the display, clearing the display, and performing calculations.

Getting Started

Clone the repository to your local machine:

git clone

Open the calculator.html file in any modern web browser.

Usage

Click on the buttons to input numbers and operators.

Press = to evaluate the expression.

Press C to clear the display.

Code Overview

HTML (calculator.html)

Defines the structure of the calculator, including:

An input field for the display.

Buttons for numbers, operators, and actions.

CSS (styles.css)

Styles the calculator with a clean and responsive design.

Uses grid layout for arranging the buttons.

Defines hover and active states for better user experience.

JavaScript (script.js)

appendToDisplay(value): Adds the pressed button value to the display.

clearDisplay(): Clears the content of the display.

calculate(): Evaluates the arithmetic expression entered in the display and handles errors gracefully.

Preview

Contributing

Contributions are welcome! If you have suggestions or improvements, feel free to open an issue or submit a pull request.

License

This project is open-source and available under the MIT License.

About

This basic calculator is a beginner-friendly web application designed to perform fundamental arithmetic operations such as addition, subtraction, multiplication, and division. It is implemented using HTML, CSS, and JavaScript to provide structure, styling, and interactivity, respectively.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published