๐Ÿ•ธ Algorithm/๐Ÿ•ธ ๋ฐฑ์ค€ BaekJoon

[๋ฐฑ์ค€][java][8393][ํ•ฉ]

๋‰ด์ด NUEY 2023. 10. 3. 18:09
๋ฐ˜์‘ํ˜•

import java.util.Scanner;

// 	8393	ํ•ฉ
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int sum = 0;
		int num = sc.nextInt();
		sc.close();
		
		for (int i = 1; i <= num; i++) {
			sum += i;
		}
		
		System.out.print(sum);
	} 
}

 

 

 

๋ฐ˜์‘ํ˜•