# [Algorithm/JS] ๋ฐฑ์ค€ 2739๋ฒˆ ๊ตฌ๊ตฌ๋‹จ

๐Ÿ”— ๋ฌธ์ œ ๋ฐ”๋กœ๊ฐ€๊ธฐ (opens new window)

# Question

N์„ ์ž…๋ ฅ๋ฐ›์€ ๋’ค, ๊ตฌ๊ตฌ๋‹จ N๋‹จ์„ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. ์ถœ๋ ฅ ํ˜•์‹์— ๋งž์ถฐ์„œ ์ถœ๋ ฅํ•˜๋ฉด ๋œ๋‹ค.

# Input

์ฒซ์งธ ์ค„์— N์ด ์ฃผ์–ด์ง„๋‹ค. N์€ 1๋ณด๋‹ค ํฌ๊ฑฐ๋‚˜ ๊ฐ™๊ณ , 9๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™๋‹ค.

# Output

์ถœ๋ ฅํ˜•์‹๊ณผ ๊ฐ™๊ฒŒ N1๋ถ€ํ„ฐ N9๊นŒ์ง€ ์ถœ๋ ฅํ•œ๋‹ค.

# Example

# Input

2
1

# Output

2 * 1 = 2
2 * 2 = 4
2 * 3 = 6
2 * 4 = 8
2 * 5 = 10
2 * 6 = 12
2 * 7 = 14
2 * 8 = 16
2 * 9 = 18
1
2
3
4
5
6
7
8
9

# Solution

const input = require('fs').readFileSync('dev/stdin').toString();
for (let i = 1; i < 10; i++) {
  console.log(`${input} * ${i} = ${input * i}`);
}
1
2
3
4

๊ฒฐ๊ณผ: ์ถœ๋ ฅ ํ˜•์‹์ด ์ž˜๋ชป๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

input ๊ฐ’์„ ์ž˜๋ชป ๋ฐ›์•„์™”๋‚˜? ๋ผ๋Š” ์ƒ๊ฐ์— ์ฝ˜์†”์— ์ถœ๋ ฅํ•ด๋ณด์•˜์ง€๋งŒ ๊ฐ’์€ ์ œ๋Œ€๋กœ ๋ฐ›์•„์™”๋‹ค. ๊ทธ๋ ‡๋‹ค๋ฉด ๋ฌธ์ œ๋Š” Number ํƒ€์ž…์œผ๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๊ณผ์ •์—†์ด ๊ทธ๋Œ€๋กœ ๋ฐ›์•„์™”๊ธฐ ๋•Œ๋ฌธ์— input์˜ ํƒ€์์€ ๋ฌธ์ž์—ด ํƒ€์ž…์ผ ๊ฒƒ์ด๋ผ ์ƒ๊ฐํ–ˆ๋‹ค. Number ํƒ€์ž…์œผ๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๊ณผ์ •์„ ์ถ”๊ฐ€ํ–ˆ๋”๋‹ˆ ๊ฒฐ๊ณผ๋Š” ์„ฑ๊ณต์ด๋‹ค!

# ๋ฌธ์ œ ํ•ด๊ฒฐ


ย 




const input = require('fs').readFileSync("dev/stdin").toString();
let num = Number(input);
for(let i = 1; i <= 9; i ++) {
  console.log(`${num} * ${i} = ${num * i}`);
}
1
2
3
4
5
Last Updated: 2022. 6. 5. ์˜คํ›„ 3:42:39