A professional, responsive calculator web application built with HTML, CSS, and JavaScript.
- ✅ Basic arithmetic operations (Addition, Subtraction, Multiplication, Division)
- ✅ Decimal point support
- ✅ Delete (DEL) button to remove last digit
- ✅ Clear (C) button to reset
- ✅ Error handling (division by zero)
- ✅ Floating point precision handling
- ✅ Fully responsive design (works on mobile, tablet, desktop)
- ✅ Modern UI with smooth animations
- ✅ Color-coded buttons for better UX
- A modern web browser (Chrome, Firefox, Safari, Edge)
-
Clone the repository:
git clone https://github.com/Ranjeet2063/calculator.git
-
Navigate to the project:
cd calculator -
Open in browser:
- Double-click
index.html, or - Right-click → Open with → Your browser
- Double-click
calculator/
├── index.html # Main HTML file
├── src/
│ ├── style.css # CSS styling
│ └── script.js # JavaScript functionality
├── README.md # Documentation
└── .gitignore # Git ignore file
- Shows current input and calculation results
- Dark theme with green text (retro calculator style)
- Prevents overflow with text ellipsis
- Numbers (0-9): Light gray buttons
- Operators (+, −, ×, ÷): Purple buttons
- Equals (=): Green button
- Clear (C): Red button
- Delete (DEL): Orange button
- HTML5 - Structure
- CSS3 - Styling with animations and gradients
- JavaScript (ES6) - Functionality and logic
- Desktop: Optimized for large screens
- Tablet: Adjusted padding and font sizes
- Mobile: Compact layout with touch-friendly buttons
- Number Input: Click number buttons to build your expression
- Operations: Click an operator button
- Continue: Enter the next number
- Calculate: Press
=to see the result - Clear: Press
Cto reset everything - Delete: Press
DELto remove the last digit
- Division by zero: Shows "Error: Cannot divide by 0"
- Multiple decimals: Prevents adding multiple decimal points
- Floating point precision: Rounds to 8 decimal places
- Add percentage (%) button
- Add square root (√) button
- Add memory functions (M+, M-, MR, MC)
- Add keyboard support
- Add calculation history
- Dark/Light theme toggle
- Sound effects for button clicks
MIT License - Feel free to use and modify this project.
Ranjeet2063
For issues or suggestions, please open a GitHub issue.
Made with ❤️ - Enjoy calculating!