프로그래밍/Java

for문 실습_1

유니렌 2024. 12. 19. 13:27
package ch04.sec04;

//1~10까지의 합을 출력하시오.
public class PrintFrom1To10Example2 {

	public static void main(String[] args) {
		int i = 0;
		for (; i < 10; i++) {
			System.out.print((i+1)+" ");
		}
		System.out.println();
		System.out.print("반복 횟수는 "+(i));
	}

}

 

 

'프로그래밍 > Java' 카테고리의 다른 글

디버깅  (0) 2024.12.19
For문 실습_2  (0) 2024.12.19
반복문의 중요성  (0) 2024.12.19
If문 실습_4 윤 년 , 평 년 구하는 프로그램  (0) 2024.12.19
메모리 확인 하는 법  (0) 2024.12.19