import java.util.Scanner;
public class Main15596 {
public 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) {
Scanner s = new Scanner(System.in);
int[] a = {1,2,3,4,5};
System.out.println(sum(a));
}
}
'휴지통 > 알고리즘 & 자료구조' 카테고리의 다른 글
백준 1065 (0) | 2021.07.09 |
---|---|
백준 4673 (0) | 2021.07.09 |
깊이 우선 탐색 (DFS) (0) | 2021.07.09 |
너비 우선 탐색 (BFS) (0) | 2021.07.09 |
백준 4344 (0) | 2021.07.08 |