SWEA_2025) N줄덧셈

2025) N줄덧셈 (19.10.01)


문제 링크 (SW Expert Academy)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import java.io.*;
public class Solution {
    public static void main(String args[]) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        
        int n = Integer.parseInt(br.readLine());
        int sum = 0;
        for(int i=1;i<=n;i++) {
            sum = sum+i;
        }
        
        bw.write(String.valueOf(sum));
        bw.flush();
        bw.close();
    }
}
cs

댓글

이 블로그의 인기 게시물