Programming/BaekJoon

백준 8393번 합

helloworld: 2021. 7. 15. 06:42

 

package for_;

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

public class 합 {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    int n = Integer.parseInt(br.readLine());
    br.close();
    
    int result = 0;

    for(int i = 1; i <= n; i++) {
      result+=i;
    }
    System.out.println(result);
  }
}