Skip to content

lucasfelipe32/simple-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Simple Calculator in Python

This project was developed for academic purposes and serves as a simple calculator implemented in Python. It offers basic mathematical operations such as addition, subtraction, multiplication, and division. The user can choose an operation, input two numbers, and get the result. The calculator also checks for division by zero to prevent errors.

Features

The program offers the following functionalities:

  • Addition of two numbers
  • Subtraction of two numbers
  • Multiplication of two numbers
  • Division of two numbers (with division by zero check)
  • Option to exit the program

How to Use

  1. When the program starts, the available operations are displayed:

    • 1 - Addition
    • 2 - Subtraction
    • 3 - Multiplication
    • 4 - Division
    • 5 - Exit the program
  2. The user selects the desired operation by entering the corresponding number.

  3. The program then asks the user to input two numbers to perform the operation.

  4. The result of the operation is displayed.

  5. The user can repeat the process or choose 5 to exit the program.

Execution Example

1 - Addition
2 - Subtraction
3 - Multiplication
4 - Division
5 - Exit the program

Choose your option: 1
Enter a number (N1): 10
Enter a number (N2): 20
30.0

Validation

  • The calculator checks for division by zero and displays an appropriate error message.

Requirements

  • Python 3.x

How to Run

  1. Clone or download the repository.
  2. Open a terminal and navigate to the directory where the code is located.
  3. Run the script with the command:
python name_of_the_file.py

About

Simple calculator project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages