# [Algorithm/JS] ๋ฐฑ์ค€ 10950๋ฒˆ ํ•ฉ

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

# Question

n์ด ์ฃผ์–ด์กŒ์„ ๋•Œ, 1๋ถ€ํ„ฐ n๊นŒ์ง€ ํ•ฉ์„ ๊ตฌํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.

# Input

์ฒซ์งธ ์ค„์— n (1 โ‰ค n โ‰ค 10,000)์ด ์ฃผ์–ด์ง„๋‹ค.

# Output

1๋ถ€ํ„ฐ n๊นŒ์ง€ ํ•ฉ์„ ์ถœ๋ ฅํ•œ๋‹ค.

# Example

# Input

3
1

# Output

6
1

# Solution

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