Skip to content

Commit

Permalink
msg
Browse files Browse the repository at this point in the history
  • Loading branch information
Synic-dx committed May 28, 2024
1 parent 2132348 commit 2a5340c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
17 changes: 17 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 1,17 @@
function hcfCalc(num1, num2) {
let hcfValue = 1;

function getSmallerNum(num1, num2) {
return num1 < num2 ? num1 : num2;
}

for (let i = 1; i <= getSmallerNum(num1, num2); i ) {
if (num1 % i === 0 && num2 % i === 0) {
hcfValue = i;
}
}

return hcfValue;
}

module.exports = hcfCalc;
22 changes: 22 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 1,22 @@
{
"name": "hcf-calc",
"version": "1.0.0",
"description": "A Package to calculate the HCF of any two given numbers.",
"main": "index.js",
"scripts": {
"test": "npm run test"
},
"repository": {
"type": "git",
"url": "git https://github.com/Synic-dx/HCF-Calc.git"
},
"keywords": [
"npm"
],
"author": "Shinjan",
"license": "MIT",
"bugs": {
"url": "https://github.com/Synic-dx/HCF-Calc/issues"
},
"homepage": "https://github.com/Synic-dx/HCF-Calc#readme"
}

0 comments on commit 2a5340c

Please sign in to comment.