A simple and user-friendly calculator web application that supports basic arithmetic operations and complex calculations. The calculator can be operated using both mouse clicks and keyboard inputs.
- Basic Arithmetic Operations: Addition, Subtraction, Multiplication, and Division.
- Parentheses Support: Handle complex expressions using parentheses.
- Percentage Calculations: Support for percentage operations.
- Clear (AC) and Backspace Functionalities: Easily clear input or delete the last character.
- Real-Time Input Display Formatting: Clean and user-friendly input display.
- Keyboard Support: Convenient keyboard input for quick calculations.
To use this calculator, clone the repository and open the calculator.html
file in your web browser.
git clone https://github.com/CharakaMihiranga/calculator.git
cd calculator
open calculator.html
Click the buttons on the calculator to input numbers and operations.
You can also use the following keyboard keys to operate the calculator:
0-9
: Numbers+
: Addition-
: Subtraction*
: Multiplication/
: Division%
: Percentage(
,)
: Parentheses.
: Decimal pointEnter
: EqualsBackspace
: Delete the last characterDelete
: Clear the input
calculator.html
: The main HTML file that contains the structure of the calculator.style/style.css
: The CSS file for styling the calculator.js/script.js
: The JavaScript file containing the logic for the calculator.
The HTML file sets up the structure of the calculator. It includes buttons for each number and operation, and display areas for the input and output.
The CSS file is used to style the calculator, making it visually appealing and user-friendly.
The JavaScript file handles the logic of the calculator. It includes event listeners for button clicks and keyboard inputs, functions to validate and clean the input, and to prepare and display the output.
Here are some screenshots of the calculator in action: