728x90
반응형
https://www.acmicpc.net/problem/15596
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
public class Test {
static long sum(int[] a) {
long ans = 0;
for(int i=0; i<a.length; i++) {
ans += a[i];
}
return ans;
}
public static void main(String[] args) {
int [] arr = {1,2,3,4,5};
System.out.println(sum(arr));
}
}
|
cs |
728x90
반응형
'알고리즘' 카테고리의 다른 글
[프로그래머스] 스킬 체크 테스트 Level.1 - 문제 2 (0) | 2023.01.17 |
---|---|
[프로그래머스] 스킬 체크 테스트 Level.1 - 문제 1 (0) | 2023.01.17 |
백준 알고리즘 11720번: 숫자의 합 - JAVA (0) | 2022.12.08 |
백준 알고리즘 10818번: 최소, 최대 - JAVA (0) | 2022.12.08 |
백준 알고리즘 8958번: OX퀴즈 - JAVA (0) | 2022.12.08 |