"JS10 Day 1: Arithmetic Operators"의 두 판 사이의 차이

(새 문서: ==개요== ;<nowiki>Day 1: Arithmetic Operators</nowiki> * Tutorials - 10 Days of Javascript - Day 1: Arithmetic Operators * https://www.hackerrank.com/challenges/js10-arithmetic-oper...)
 
잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
 
(다른 사용자 한 명의 중간 판 7개는 보이지 않습니다)
4번째 줄: 4번째 줄:
* https://www.hackerrank.com/challenges/js10-arithmetic-operators/problem
* https://www.hackerrank.com/challenges/js10-arithmetic-operators/problem


<source lang='javascript'>
{{JS10 헤더}}
{{JS10 0-1}}
|}
 
----
 
<syntaxhighlight lang='javascript'>
'use strict';
 
process.stdin.resume();
process.stdin.setEncoding('utf-8');
 
let inputString = '';
let currentLine = 0;
 
process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});
 
process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
   
    main();   
});
 
function readLine() {
    return inputString[currentLine++];
}
</syntaxhighlight>
<syntaxhighlight lang='javascript'>
function getArea(length, width) {
function getArea(length, width) {
     return length * width;
     return length * width;
11번째 줄: 42번째 줄:
     return ( length + width )* 2;
     return ( length + width )* 2;
}
}
</source>
</syntaxhighlight>
 
<syntaxhighlight lang='javascript'>
==같이 보기==
function main() {
* [[해커랭크 10 Days of Javascript]]
    const length = +(readLine());
* [[해커랭크 String Transmission]]
    const width = +(readLine());
 
   
[[분류: 10 Days of Javascript]]
    console.log(getArea(length, width));
    console.log(getPerimeter(length, width));
}
</syntaxhighlight>

2020년 11월 2일 (월) 02:52 기준 최신판

개요[ | ]

Day 1: Arithmetic Operators
해커랭크 10 Days of Javascript
# 문제 비고
0-1 Day e
1 JS10 Day 0: Hello, World!
2 JS10 Day 0: Data Types
3 JS10 Day 1: Arithmetic Operators
4 JS10 Day 1: Functions
5 JS10 Day 1: Let and Const

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    
    main();    
});

function readLine() {
    return inputString[currentLine++];
}
function getArea(length, width) {
    return length * width;
}
function getPerimeter(length, width) {
    return ( length + width )* 2;
}
function main() {
    const length = +(readLine());
    const width = +(readLine());
    
    console.log(getArea(length, width));
    console.log(getPerimeter(length, width));
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}