test_cal_ss
v1.0.3
Published
this is simple calculator
Downloads
10
Readme
Calculator Module
This is a simple calculator module that provides basic arithmetic operations such as addition, subtraction, multiplication, and division.
Installation
To use this module, you need to have Node.js installed. You can include this module in your project by copying the code into a file named calculator.js
.
Usage
- Create a file named
calculator.js
and paste the provided code for the calculator module. - In your main project file, require the
calculator
module and use its methods for arithmetic operations.
API
The calculator module provides the following methods:
add(a, b)
: Returns the sum ofa
andb
.substract(a, b)
: Returns the difference ofa
andb
.multiplay(a, b)
: Returns the product ofa
andb
.divide(a, b)
: Returns the quotient ofa
andb
.
Example
Here's an example of how to use the calculator module in your project:
- Create a
calculator.js
file with the module code. - In your main file, require and use the calculator module to perform arithmetic operations.
const calculator = require('./calculator');
const num1 = 10;
const num2 = 5;
console.log(`Addition: ${calculator.add(num1, num2)}`); // Output: 15
console.log(`Subtraction: ${calculator.substract(num1, num2)}`); // Output: 5
console.log(`Multiplication: ${calculator.multiplay(num1, num2)}`); // Output: 50
console.log(`Division: ${calculator.divide(num1, num2)}`); // Output: 2