알고리즘/백준 알고리즘
[java] 백준 알고리즘 8393번 합 풀이소스
희랍인 조르바
2018. 5. 12. 16:40
단순 for문을 이용한 문제.
* 풀이소스
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | public class Baekjoon8393 { public static void main(String[] args) throws NumberFormatException, IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); long sum = 0; for(int i=1; i<=n; i++){ sum += i; } System.out.println(sum); } } | cs |