This project is a simple scientific calculator built with HTML, CSS, and JavaScript. The calculator provides both basic arithmetic operations and advanced scientific functions, including trigonometric calculations, exponents, and square roots.
- Basic arithmetic operations: addition, subtraction, multiplication, and division.
- Scientific operations: exponentiation, trigonometric functions (sin, cos, tan), and square roots.
- Use of the mathematical constant π (Pi).
- Advanced mode for trigonometric and scientific functions that can be toggled on and off.
- History panel to keep track of previous calculations.
- Keyboard input support for better user experience.
-
Clone this repository to your local machine:
git clone https://github.com/FreecssY/Calculator.git
-
Navigate into the project directory:
cd Calculator -
Open the
public/index.htmlfile in your preferred web browser to use the calculator.
- Click on the buttons to enter numbers and operations, or use your keyboard for input.
- Use the "Advanced" button to toggle additional functions like sin, cos, tan, square root, and exponentiation.
- The calculator history displays the last few calculations and can be adjusted in size.
- Use the backspace button (←) to delete the last character or operation.
- The "C" button clears the entire display.
- Numbers:
0-9 - Decimal point:
. - Basic operators:
+,-,*,/ - Exponentiation:
^ - Trigonometric functions: Type "sin", "cos", or "tan" and press enter.
- Square root: Type "sqrt(" followed by the number and closing parenthesis
). - Pi (π): Type "pi"
- Backspace:
Backspace - Calculate:
Enter - Clear display:
Escape
calculator/
├── index.js
├── package.json
├── package-lock.json
├── public
│ ├── index.html
│ ├── script.js
│ └── styles.css
├── README.md
└── routes
└── calculator.js
3 directories, 8 files
A live preview of the calculator is available here: Live Preview
You can customize the calculator by modifying the CSS for different styles or enhancing the JavaScript code to add more features such as logarithms or factorial calculations.
This project is open-source and available under the MIT License. You are free to use, modify, and distribute this project.
Contributions are welcome! If you'd like to add more features or improve the project, feel free to fork the repository and submit a pull request.
- This project was built as a learning exercise for JavaScript, HTML, and CSS.
- Inspired by classic scientific calculators with an easy-to-use interface.
For any inquiries, please contact freecssy31@gmail.com.