합 (8393)

552 단어 백준OJ백준OJ

Java 11

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {

        int n = Integer.parseInt(new BufferedReader(new InputStreamReader(System.in)).readLine());
        int s = 0;

        for (int i = 1; i<= n; i++) {
            s += i;
        }

        System.out.println(s);
    }
}

좋은 웹페이지 즐겨찾기