Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

C Calculator

Description

A simple CLI calculator written in C that allows users to perform basic arithmetic operations. The program supports addition, subtraction, multiplication, and division with input validation.


Features

  • Perform basic math operations:

    1. Addition
    2. Subtraction
    3. Multiplication
    4. Division
  • Handles invalid user input

  • Runs in a loop until the user exits


How It Works

  1. The program takes two numbers and a character representing the operation (A/S/M/D) from the user
  2. It performs the selected operation on the two numbers
  3. It prints the result

How to Run

  1. Compile the code using c compiler :
    Example :
    gcc calc.c -o calc

  2. Run the program
    ./calc

Example

Enter the first letter of the operation (A/S/M/D): a
First number: 20
Second number: 30
The answer is: 50
Do you want to calculate anything else? (y/n): n


What I Learned

  • Using C to perform calculations
  • Handling invalid user input
  • Working with loops
  • Using functions to organize code

Language Used

  • C

Author

Mostafa Oraby

About

Simple CLI calculator in C with input validation and basic arithmetic operations.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages