mathbymsd
v1.0.5
Published
This package is for solve some mathematical equation to users
Downloads
61
Maintainers
Readme
mathbymsd - HCF and LCM Calculations
This is a simple npm package that provides functions for calculating the Highest Common Factor (HCF) and Least Common Multiple (LCM) of numbers. It supports both two numbers and multiple numbers for both HCF and LCM calculations.
🚀Features
- Calculate HCF (Greatest Common Divisor) for two or more numbers.
- Calculate LCM (Least Common Multiple) for two or more numbers.
📦Installation
To install this package, you can use npm. Run the following command in your project directory:
npm install mathbymsd
🧮Functions
- hcf(a, b) Calculates the Highest Common Factor (HCF) of two numbers.
Parameters: a (number): First number. b (number): Second number. Returns: The HCF of the two numbers.
const { hcf } = require('mathbymsd');
const result = hcf(12, 15);
console.log(result); // Output: 3
- lcm(a, b) Calculates the Least Common Multiple (LCM) of two numbers.
Parameters: a (number): First number. b (number): Second number. Returns: The LCM of the two numbers.
const { lcm } = require('mathbymsd');
const result = lcm(12, 15);
console.log(result); // Output: 60
- hcfMultiple(a, b, c, d, ...) Calculates the Highest Common Factor (HCF) for multiple numbers.
Parameters: a, b, c, d, ... (numbers): The numbers to calculate the HCF of. Returns: The HCF of the given numbers.
const { hcfMultiple } = require('mathbymsd');
const result = hcfMultiple(12, 15, 18);
console.log(result); // Output: 3
- lcmMultiple(a, b, c, d, ...) Calculates the Least Common Multiple (LCM) for multiple numbers.
Parameters: a, b, c, d, ... (numbers): The numbers to calculate the LCM of. Returns: The LCM of the given numbers.
const { lcmMultiple } = require('mathbymsd');
const result = lcmMultiple(12, 15, 20);
console.log(result); // Output: 60
📝License
This package is open source and available under the MIT License.