백준 입출력방식
Mar 25, 2021
»
JavaScript
백준 자바스크립트 값 입력 받기
-
const fs = require("fs"); const inputData = fs.readFileSync("/dev/stdin").toString().split(" "); inputData[0]; inputData[1];
-
// ex 백준 2739 구구단 예제 const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); let input = []; let fixedPoint = 0; rl.on('line', function(line) { input = line.split(' ').map((_) => Number(_)); }).on('close', funcion () { fixedPoint = input[0] for(let i = 1; i <= 9; i++) { console.log(`${fixedPoint} * ${i} = ${fixedPoint * i}`); } process.exit(); });