Shift + Enter · 시작/다시 시작
코드 프롬프트 가이드 읽기
- 프로그래밍 언어
- Java
- 난이도
- 중간
Traverse a list and calculate its total.
import java.util.List;
public class Main {
public static void main(String[] args) {
List<Integer> values = List.of(4, 8, 15, 16);
int total = 0;
for (int value : values) {
total += value;
}
System.out.println(total);
}
}