The Basic Calculator C implementation is a simple command-line calculator that allows users to perform basic arithmetic operations, such as addition, subtraction, multiplication, and division. The calculator takes user input and displays the result of the specified operation.
This project aims to provide an easy-to-understand example of how to build a basic calculator using C. It is a great starting point for people learning C programming and looking to practice fundamental concepts, such as functions, control flow, and user input.
This are the following operations that can be performed with this calculator:
- Addition: Perform addition of two numbers.
- Subtraction: Perform subtraction of two numbers.
- Multiplication: Perform multiplication of two numbers.
- Division: Perform division of two numbers.
Using this program run the following commands in your terminal:
- Clone the Demo-Project repository using this command
git clone <link to Demo-Project repository>
- Change Directory to
samuelejalonibu
using this commandcd samuelejalonibu
- Compile the program using C compiler, use this command
gcc *.c -o calculator
- Run the compiled executable using this command
./calculator
- Enter two numbers and an arithmetic operator when asked
- Then you'll see your result
Here is an example of how to use the calculator:
Welcome to the Basic Calculator!
Choose an operation:
1. Addition
2. Subtraction
3. Multiplication
4. Division
Enter your operator: +
Enter the first number: 10
Enter the second number: 20
Result: 10 + 20 = 30
Feel free to try out different operations and numbers to explore the calculator's functionality.
Happy calculating and keep exploring C programming!