Skip to content

SuluJulianto/simple-caculator

Repository files navigation

Mathematical Operations Calculator

This repository showcases code snippets written in various programming languages to perform basic arithmetic operations based on user input. Each code snippet is designed to handle mathematical expressions involving addition, subtraction, multiplication, division, exponentiation, integer division, and modulus.

Python

The Python script functions as a simple calculator. It prompts the user to input a mathematical expression (e.g., 10 + 5) and processes it to identify the operation (+). After splitting the expression, it performs the operation and prints the result along with the original expression.

JavaScript

Similar to the Python version, the JavaScript code takes a mathematical expression as input and extracts the operation from it. It then computes the result using basic arithmetic functions and displays both the expression and the calculated answer to the user.

Ruby

The Ruby code operates similarly to the Python and JavaScript versions. It reads a mathematical expression, identifies the operation, performs the calculation, and presents the original expression alongside the computed result.

PHP

The PHP code snippet acts as a mathematical calculator, accepting user input in the form of a mathematical expression. It processes the input, performs the arithmetic operation, and outputs both the original expression and the computed answer.

C

The C code is a command-line application that receives a mathematical expression as input. It utilizes string manipulation and arithmetic operations to interpret the expression and produce the calculated result. The supported operations include addition, subtraction, multiplication, division, exponentiation, integer division, and modulus.

C++

The C++ code provides a command-line interface for mathematical calculations. It reads the user's input, identifies the operation, and calculates the result using the appropriate arithmetic operation. It supports basic arithmetic operations and displays the original expression with the computed answer.

Java

The Java code operates similarly to its counterparts, accepting a mathematical expression and performing calculations. It supports various arithmetic operations and showcases the result along with the original expression.

GoLang

The GoLang code snippet functions as a mathematical expression evaluator. It accepts input in the form of a mathematical expression, identifies the operation, performs the calculation, and displays both the original expression and the computed result.

This repository aims to demonstrate how different programming languages handle basic arithmetic operations in a user-friendly manner. Feel free to explore and use these code snippets to understand arithmetic operations in different programming paradigms.

About

Simple caculator in Multiple Programming Languages

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published