Notice
Recent Posts
Recent Comments
Link
250x250
목록더하기 (1)
develope_kkyu
[JAVA] 1부터 100까지 더하기
public static void main(String[] args) { // for문은 활용하여 1~100까지의 누적합 구하기. int total = 0; int index;// for문 밖에서 index를 사용하는 부분이 있기 때문에 변수 선언은 for문 밖에서 사용. for (index=1; index 초기값을 설정 // index 반복에 대한 조건. // index++ ==> for문 마감시 처리하는 실행문 total = total + index; System.out.printf("%d번째까지의 누적합 %d입니다. \n", index, total); } System.out.printf("index = %d \t total=%d \n", index-1, total); } -- 1번째까지의 누적합 1..
JAVA/Java SE
2022. 12. 21. 17:15