Skip to content

Wreaking/calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

Simple Calculator

Welcome to the Simple Calculator project! This interactive tool is designed to perform a variety of mathematical operations, including arithmetic, comparison, and trigonometric calculations.

Features

  • Arithmetic Operations: Add, subtract, multiply, divide, and more!
  • Comparison Operations: Compare two numbers with various operators.
  • Trigonometric Functions: Calculate sine, cosine, tangent, and hyperbolic functions.

Algorithm

  1. Start

  2. Display Welcome Message

  • Print a welcome message with options for operations.
  1. Prompt for Arithmetic Operations
  • Ask the user if they want to perform arithmetic operations (Y/N).
  1. If User Chooses Arithmetic (Y) Prompt for the type of arithmetic operator (e.g., +, -, *, /, %, **). Prompt for result type (Integer/Float). Input two numbers (num1andnum2').

  2. Perform Selected Arithmetic Operation

  • If Addition: Calculate result and display in a table.
  • If Subtraction: Calculate result and display in a table.
  • If Multiplication: Calculate result and display in a table.
  • If Division:
  • Check for division by zero. If valid, calculate and display result.
  • If Modulus: Calculate result and display in a table.
  • If Exponentiation: Calculate result and display in a table.
  • If Floor Division: Calculate result and display in a table.
  • Else: Print invalid operator message.
  1. If User Chooses Comparison (N) Prompt for comparison operations (Y/N).
  • If user chooses (Y): Input two numbers (num1andnum2`). Prompt for comparison operator (e.g., ==, >, <). Evaluate and display result in a table.
  1. If User Chooses Trigonometry (N Prompt for trigonometric operations (Y/N). If user chooses (Y):
  • Input angle in degrees (num1'). Convert angle to radians. Prompt for trigonometric operator (e.g., Sin, Cos, Tan). Calculate and display result in a table.
  1. If User Chooses No Operations Display a message asking why they are using the calculator.

  2. End

Flowchart

image

How to Use

  1. Clone the Repository:

    git clone https://github.com/Wreaking/calculator.git
  2. Navigate to the Project Directory:

    cd calculator
  3. Run the Calculator: Open your terminal and execute:

    python calculator.py
  4. Follow the Prompts: The calculator will guide you through various operations.

Contributors

Screenshots

  • Arthimethic Operation:

image

  • Comparision Operation:

image

  • Trignometric Operation:

image

License

This project is licensed under the Apache License. See the LICENSE file for details.

Acknowledgments

  • Thanks to PrettyTable for making table outputs more presentable.

About

Simple calculator for beginners

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages