Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Simple Calculator

A professional, responsive calculator web application built with HTML, CSS, and JavaScript.

✨ Features

  • ✅ 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

🚀 Quick Start

Prerequisites

  • A modern web browser (Chrome, Firefox, Safari, Edge)

Installation

  1. Clone the repository:

    git clone https://github.com/Ranjeet2063/calculator.git
  2. Navigate to the project:

    cd calculator
  3. Open in browser:

    • Double-click index.html, or
    • Right-click → Open with → Your browser

📁 Project Structure

calculator/
├── index.html          # Main HTML file
├── src/
│   ├── style.css      # CSS styling
│   └── script.js      # JavaScript functionality
├── README.md          # Documentation
└── .gitignore         # Git ignore file

🎨 UI Components

Display

  • Shows current input and calculation results
  • Dark theme with green text (retro calculator style)
  • Prevents overflow with text ellipsis

Buttons

  • Numbers (0-9): Light gray buttons
  • Operators (+, −, ×, ÷): Purple buttons
  • Equals (=): Green button
  • Clear (C): Red button
  • Delete (DEL): Orange button

💻 Technology Stack

  • HTML5 - Structure
  • CSS3 - Styling with animations and gradients
  • JavaScript (ES6) - Functionality and logic

📱 Responsive Design

  • Desktop: Optimized for large screens
  • Tablet: Adjusted padding and font sizes
  • Mobile: Compact layout with touch-friendly buttons

🔧 How It Works

  1. Number Input: Click number buttons to build your expression
  2. Operations: Click an operator button
  3. Continue: Enter the next number
  4. Calculate: Press = to see the result
  5. Clear: Press C to reset everything
  6. Delete: Press DEL to remove the last digit

🐛 Error Handling

  • Division by zero: Shows "Error: Cannot divide by 0"
  • Multiple decimals: Prevents adding multiple decimal points
  • Floating point precision: Rounds to 8 decimal places

🎯 Future Enhancements

  • 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

📄 License

MIT License - Feel free to use and modify this project.

👨‍💻 Author

Ranjeet2063

📧 Support

For issues or suggestions, please open a GitHub issue.


Made with ❤️ - Enjoy calculating!

About

A simple calculator built using HTML, CSS and JavaScript. Supports basic arithmetic operations with clean UI.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages