본문 바로가기

Algorithm/Baekjoon

[백준] #8393: 합

import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int result = 0;
		
		for(int i = 1; i <= n; i++) {
			result += i;
		}	
		System.out.println(result);
	}
}

'Algorithm > Baekjoon' 카테고리의 다른 글

[백준_JAVA] 25314 코딩은 체육과목 입니다  (0) 2023.06.25
[백준_JAVA] 11382 꼬마 정민  (0) 2023.06.24
[백준] #10950: A + B - 3  (0) 2022.03.11
[백준] #2739: 구구단  (0) 2022.02.24
[백준] #2480: 주사위 세개  (0) 2022.02.24