๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๊ฐœ์ธ๊ณต๋ถ€/Algorithm

[๋ฐฑ์ค€][Node.js] 4504๋ฒˆ : ๋ฐฐ์ˆ˜ ์ฐพ๊ธฐ

by ๐Ÿ‡๋ฐ•๋ด‰๋ด‰๐Ÿ‡ 2021. 10. 26.

 

 

Algorithm

-  ๋ฐฐ์ˆ˜ ์ฐพ๊ธฐ -

 


 

๋ฌธ์ œ

์ •์ˆ˜ n(0 < n < 1000)๊ณผ ์ˆ˜์˜ ๋ชฉ๋ก์ด ์ฃผ์–ด์กŒ์„ ๋•Œ, ๋ชฉ๋ก์— ๋“ค์–ด์žˆ๋Š” ์ˆ˜๊ฐ€ n์˜ ๋ฐฐ์ˆ˜์ธ์ง€ ์•„๋‹Œ์ง€๋ฅผ ๊ตฌํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.

 

์ž…์ถœ๋ ฅ ์˜ˆ์‹œ

 

๋ฌธ์ œ ํ’€๊ธฐ

const readline = require("readline");
const rl = readline.createInterface({
	input: process.stdin,
	output: process.stdout,
});
let input = [];
rl.on("line", function (line) {
	input.push(line.toString());
}).on("close", function () {
    input = input.map((el) => Number(el));
    let number = input.shift();

for (let i = 0; i < input.length - 1; i++) {
	if (input[i] % number === 0) console.log(`${input[i]} is a multiple of ${number}.`);
	else console.log(`${input[i]} is NOT a multiple of ${number}.`);
}
	process.exit();
});

 

 

 

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€