728x90
import java.io.*;
class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int sum = 0;
for (int i = 1; i <= n; i++) {
sum += i;
}
StringBuilder sb = new StringBuilder();
sb.append(sum);
System.out.print(sb);
}
}
728x90
'✍ Baekjoon' 카테고리의 다른 글
[백준/JAVA] 11021번 A+B - 7 (0) | 2022.06.11 |
---|---|
[백준/JAVA] 15552번 빠른 A+B (0) | 2022.06.11 |
[백준/JAVA] 2525번 오븐 시계 (0) | 2022.06.10 |
[백준/JAVA] 2884번 알람 시계 (0) | 2022.06.10 |
[백준/JAVA] 14681번 사분면 고르기 (0) | 2022.06.09 |