A beginner-friendly console-based calculator written in C. It performs basic arithmetic operations like addition, subtraction, multiplication, and division, and operates in a continuous loop until the user chooses to exit. This calculator does not follow BODMAS rules, meaning operations are performed in the order of input.
- Simple and interactive CLI calculator
- Supports:
- Addition
- Subtraction
- Multiplication
- Division
- Clear screen after every operation
- Continuous operations until manually exited
- Platform-independent screen clearing (Windows/Linux/macOS)
- Custom user prompts for better guidance
- Compile the program:
gcc SimpleCalculator.c -o SimpleCalculator.exe- Run the program:
./SimpleCalculator.exe-
Follow on-screen prompts:
- Enter the first number.
- Choose an operation.
- Enter the next number.
- Repeat until you're done.
- Press
5to exit the program and display the final result.
- The calculator executes operations sequentially; it does not apply precedence rules like BODMAS.
- Only valid numeric inputs should be provided.
- In case of invalid operator input, the program prompts the user again.
clearScreen()– Clears the console screen depending on the operating system.chooseOperator()– Displays the operator menu.enterNumber()– Prompts user to enter a number.notValidOption()– Displays a message for invalid input and re-prompts.add(),subtract(),multiply(),division()– Functions to perform respective operations.
***** Welcome To SimpleCalculator.c *****
This Calculator not follows the rule of BODMAS <br/>
Developed By Kumar Sahil. GitHub- https://github.com/krsahil8825
----User Instruction----
1. Press '1' for addition
2. Press '2' for subtraction
3. Press '3' for multiplication
4. Press '4' for division
5. Press '5' for exit
-------Let's Start!-------
Enter a number: 10
Enter a operator: 1
Enter a number: 5
Current Result = 15.00
...
Result = 35.00
Created By Kumar Sahil.
GitHub - https://github.com/krsahil8825/SimpleCalculator.c
CopyRight (c) 2025 Kumar Sahil | All Rights Reserved.
Contributions and suggestions to improve this project are welcome. Feel free to fork the repository and submit pull requests.
This project is licensed under the Apache License 2.0.
Originally created by Kumar Sahil (2025) | All rights reserved.
Read Notice before Using in Your Project Notice