let fs = require('fs');
let input = fs.readFileSync('/dev/stdin').toString().split(' ');
let a = parseInt(input[0]);
let b = parseInt(input[1]);
console.log(a + b);
console.log(a - b);
console.log(a * b);
console.log(Math.floor(a / b));
console.log(a % b);
Math.floor() : 소수점 이하를 버림
Math.ceil() : 소수점 이하를 올림
Math.round() : 소수점 이하를 반올림
'Algorithm > Javascript' 카테고리의 다른 글
3052 js: array to set, set의 길이는 size (0) | 2023.01.15 |
---|---|
2438 js: 문자열 반복하기 (0) | 2023.01.13 |
14681 js: dev/stdin 입력 시 런타임에러 (0) | 2023.01.12 |
백준 3003 js: 배열 간의 계산 (0) | 2023.01.12 |
백준 자바스크립트 입출력 +a (0) | 2023.01.12 |
댓글