Giter VIP home page Giter VIP logo

calculator-'s Introduction

Calculator-

Calculator Banner

A simple command line calculator program written in C.

Usage

The program takes in three arguments: an operator, operand1, and operand2. The operator can be either +, -, *, or /. num1 and num2 are the two numbers you want to perform the calculation on.

To run the program, compile it with a C compiler and then run the executable file with the three arguments.

Here's an example of how to run the program:

./calculator 5 + 6

The above example will perform the calculation 5 + 6 and print the result 11 on the command line.

Error Handling

The program checks if the correct number of arguments have been provided. If less than three arguments are provided, the program will print an error message and exit with a return code of 1.

The program also checks for division by zero and prints an error message if the operator is / and the second operand is 0.

Example

Here's an example of a session using the program:

./calculator 5 + 6 11 ./calculator 10 / 0 Error: Cannot divide by zero ./calculator 6 * 5 30 ./calculator 5 - 6 -1

calculator-'s People

Contributors

emohamedd avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.