A simple command-line calculator built in C# for practicing basic programming concepts, clean code organization, and modular design.
This project supports multiple operations and includes input validation and reusable helper utilities.
- ➕ Addition
- ➖ Subtraction
- ✖️ Multiplication
- ➗ Division (with division-by-zero validation)
- 🔁 Option to continue the current operation or return to the main menu
- 🧰 Reusable utility classes for input handling and menu navigation
- 🎨 Clean and organized console layout for better readability
SimpleCalculator/
├── Program.cs # Main menu and program loop
├── Operations/ # All math operations
│ ├── Addition.cs
│ ├── Subtraction.cs
│ ├── Multiplication.cs
│ └── Division.cs
└── Utils/ # Shared helper classes
├── InputReader.cs
└── MenuHelper.cs
- Language: C#
- Runtime: .NET SDK (version 8.0 or later recommended)
- Editor: Visual Studio Code
- Clone the repository
git clone https://github.com/tarsilafritz/cli-simple-calculator.git cd cli-simple-calculator
- Build the project
dotnet build
- Run the calculator
dotnet run
Hello, welcome to the calculator program!
=== Menu of operations: ===
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exit
Please select an operation (1-5): 4
=====================================================================
4. Division
Inform the first value: 12
Inform the second value: 0
❌ You cannot divide by zero!
Please enter a non-zero divisor: 4
Do you want to add another value to the calculation? (Y/N): Y
Inform the next value: 2
Do you want to add another value to the calculation? (Y/N): N
The final result is: 1.5
Would you like to:
[C] Continue Division
[M] Return to main menu
Choose an option (C/M): C
=====================================================================
4. Division
Inform the first value: 100
Inform the second value: 25
Do you want to add another value to the calculation? (Y/N): N
The final result is: 4
Would you like to:
[C] Continue Division
[M] Return to main menu
Choose an option (C/M): M
=====================================================================
=== Menu of operations: ===
1. Addition
2. Subtraction
3. Multiplication
4. Division
5. Exit
Please select an operation (1-5): 5
Thanks for using our calculator program!
- Support for power, square root, and percentage
- Add history tracking for previous results
- Implement unit tests
- Improve menu visuals with color and better formatting
👨💻 Created by @tarsilafritz