Skip to content

MGenteluci/math-operations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Math Operations

Math Operations is a module with lots of mathematical operations.

Installation

npm install math-operations

Importing

const mathOps = require('math-operations');  

Usage

Factorial
Returns the factorial of the number sent as parameter.

mathOps.factorial(5);

Fibonacci
Returns the fibonacci of the number sent as parameter.

mathOps.fibonacci(5);

Sum
Return the sum of the numbers sent as parameters.

mathOps.sum(1, 8, 5, 2);

Bubble Sort
Return the array sent as parameter sorted with bubble sort algorithm.

mathOps.bubbleSort([8, 2, 3, 1]);

Perfect Numbers
Return true case the number sent as parameter is perfect.

mathOps.isPerfect(6);

Prime Numbers
Return true case the number sent as parameter is prime.

mathOps.isPrime(7);

Even or Odd
Two different methods that return a boolean according to the parameter sent.

Returns true case the number sent as parameter is an even number
mathOps.isEven(4);
Returns true case the number sent as parameter is an odd number
mathOps.isOdd(3);

About

Math Operations is a module with lots of mathematical operations.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published