Switch Calculator is a simple command-line calculator application written in C. It supports basic arithmetic operations such as addition, subtraction, multiplication, and division.
- Supports four basic arithmetic operations:
- Addition (+)
- Subtraction (-)
- Multiplication (*)
- Division (/)
- Takes user input for the operator and two operands
- Displays the result with a precision of one decimal place
-
Compile the
switchcalculator.c
file using a C compiler (e.g., GCC):gcc switchcalculator.c -o switchcalculator
-
Run the compiled executable:
./switchcalculator
-
Follow the prompts to enter the operator and operands:
Enter operator ( +, -, /, * ): + Enter two operands: 3.5 2.5
-
The result will be displayed:
3.5 + 2.5 = 6.0