๐งฎ Smart Calculator Web App
A modern, responsive calculator built using HTML, CSS, and JavaScript with smart input handling and clean UI.
๐ Features
- โ Basic arithmetic operations (+, โ, ร, รท)
- โก Real-time calculation
- ๐ง Smart input validation (prevents invalid expressions)
- ๐ฏ Handles negative numbers correctly
- โ Prevents multiple operators (like ++, **, etc.)
- ๐ฅ๏ธ Responsive design (works on desktop & mobile)
- ๐จ Clean and minimal UI
๐ ๏ธ Tech Stack
- Frontend: HTML, CSS, JavaScript
- Logic: Vanilla JavaScript (no libraries)
๐ Project Structure
calculator-project/
โโโ index.html
โโโ style.css
โโโ app.js
โโโ README.md
|__ images/Smart Calculator Web App.png
๐ธ Project Preview
โ๏ธ How It Works
- Captures user input via buttons
- Builds a mathematical expression as a string
- Validates input to avoid invalid operations
- Uses
eval() (or custom logic) to compute results
- Displays output dynamically on screen
๐ง Smart Logic Example
// Prevent double operators
if (["+", "-", "*", "/"].includes(value)) {
if (expression === "" || ["+", "-", "*", "/"].includes(lastChar)) {
return;
}
}
โถ๏ธ Run Locally
- Clone the repository
git clone https://github.com/YOUR_USERNAME/calculator-project.git
- Open the project
cd calculator-project
- Run in browser
Just open
index.html
๐ฅ Future Improvements
- ๐งฎ Scientific calculator mode
- ๐ Dark / Light theme toggle
- โจ๏ธ Keyboard input support
- ๐ Calculation history
- ๐ง Replace
eval() with safer parser
๐ค Contributing
Contributions are welcome!
Feel free to fork the repo and submit a pull request.
๐ License
This project is open-source and available under the MIT License.
โญ If you like this project, give it a star!