Skip to content

A simple yet powerful command-line calculator application written in C that performs various mathematical operations.

Notifications You must be signed in to change notification settings

anantrajputcode/calculator-c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

20 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Smart Calculator ๐Ÿงฎ

A simple yet powerful command-line calculator application written in C that performs various mathematical operations.

Features

  • Basic Operations

    • Addition (+)
    • Subtraction (-)
    • Multiplication (*)
    • Division (/)
    • Modulus (%)
  • Advanced Operations

    • Power (x^y)
    • Logarithm (base 10)
    • Square Root
  • User-Friendly Interface

    • Interactive menu system
    • Clear operation displays with formatted output
    • Error handling for division/modulus by zero
    • Input validation for logarithm and square root

Prerequisites

  • GCC compiler or any C compiler
  • Math library support

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/smart-calculator.git
cd smart-calculator
  1. Compile the program:
gcc -o calculator calculator.c -lm

Usage

  1. Run the compiled program:
./calculator
  1. Choose an operation by entering the corresponding number (0-9)

  2. Enter the required number(s) when prompted

  3. View the result with formatted output

  4. Press 0 to exit the program

Example

====================================
      WELCOME TO SMART CALCI
====================================
Choose an operation:
1. Addition (+)
2. Subtraction (-)
3. Multiplication (*)
4. Division (/)
5. Modulus (%)
6. Power (x^y)
8. Log(x)
9. Square root
0. Exit
Enter your choice(0 - 9): 1
Enter the first number: 25
Enter the second number: 15

โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ADDITION โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  25  +  15  =  40
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

Contributing

This project was developed using Git workflows including:

  • Branching for feature development
  • Merging changes from different branches
  • Pull requests for code review

Contributions are welcome! Please feel free to submit a Pull Request.

Development Workflow

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is open source and available under the MIT License.

Author

Your Name - @yourusername

Acknowledgments

  • Built with C programming language
  • Uses standard math library functions
  • Developed using Git version control with merge and pull workflows

โญ If you found this project helpful, please consider giving it a star!

About

A simple yet powerful command-line calculator application written in C that performs various mathematical operations.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages