시작 전
반복문 - while 과 for
꿈꾸는야오옹
2022. 7. 7. 14:37
같은 반복문을 while 과 for 로 각각 작성
int i = 0; //반복문에서 횟수 카운트 변수 i
while(i < 3) {
System.out.println(2);
System.out.println(3);
i++;
}
// 2
// 3
// 2
// 3
// 2
// 3
for(int i=0; i<3; i++) {
System.out.println(2);
System.out.println(3);
}