Skip to content

justfetz/iit-cs-402-calculator-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Calculator Project

Illinois Institute of Technology

Project Description

This project is a simple calculator application implemented in C. It supports various arithmetic operations such as addition, subtraction, multiplication, division, reciprocal, exponentiation, and factorial calculations. The calculator uses functions to handle these operations and ensures error handling for cases like division by zero and factorial of negative numbers.

Features

  • Addition (+)
  • Subtraction (-)
  • Multiplication (*)
  • Division (/)
  • Reciprocal (1/X)
  • Square (X^2)
  • Power (X^Y)
  • Factorial (N!)
  • User-friendly menu for selecting operations

Prerequisites

  • A C compiler (e.g., GCC)
  • Basic understanding of C programming

Installation

  1. Clone the repository:
    git clone https://github.com/yourusername/iit-cs-402-calculator-project

.git cd iit-cs-402-calculator-project

```
  1. Compile the program:
    gcc -o calculator calculator.c -lm

Usage

  1. Run the Program:

    ./calculator
  2. Interact with the Menu:

    • Follow the on-screen instructions to choose an operation by typing the corresponding number.
    • Input the required numbers when prompted.
    • View the result of the operation.
    • To exit the program, choose the option to quit from the menu.

Example

Please make a selection:
type corresponding number: '1. +', '2. -', '3. *', '4. /', '5. 1/X', '6. X^2', '7. X^Y', '8. N!', '9. quit'
1
Enter first number:
5
Enter second number:
3
5.0 + 3.0 = 8.0

Please make a selection:
type corresponding number: '1. +', '2. -', '3. *', '4. /', '5. 1/X', '6. X^2', '7. X^Y', '8. N!', '9. quit'
9
Exiting...

Releases

No releases published

Packages

No packages published

Languages