IT/Baekjoon Oline Judge
[BOJ] 5086번 - 배수와 약수
개발자희망생고롸파덕
2023. 8. 30. 20:49
사용언어 : javascript - node.js
# 제출 코드
const fs = require('fs');
const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt';
const input = fs.readFileSync(filePath).toString().trim().split('\n');
for (let i = 0; i < input.length; i++) {
let [a, b] = input[i]
.trim()
.split(' ')
.map((item) => +item);
if (a === 0 && b === 0) {
break;
}
solution(a, b);
}
function solution(a, b) {
if (b % a === 0) {
console.log('factor');
} else if (a % b === 0) {
console.log('mulitple');
} else {
console.log('neither');
}
}