구디아카데미

목표달성(2022.5.11)

YOO'sssss 2022. 5. 11. 21:47

■ HOMEWORK
[트러블슈팅] 그날 트러블슈팅 또는 본인 습관체크 >> 
▶ 이중 while이나 이중 do while 쓸 때 두번째 쓰는 while은 변수선언도 안에다가 한다!

▶ 세미콜론 확인!

▶ 이중 for구문 어제보다 오늘 문제푼 것들이 더 어려웠다...... 어떻게 해야하는지 이해는 하면서도 코드로 쓰는것이 어려워서 잘 되지 않았다. 선생님께 힌트도 받고 설명도 들으면서 문제 풀었는데 어려워서 집에서 다시 복습해야겠다.

 

목표달성!
1. 이중for가 무섭지 않다!  
for, while, do while 버젼으로 만드시오.
   *
   **
   ***
   ****
   *****
   ******
   *******
   ********
   *********
   **********
   ***********   //11개

 

System.out.print("★");System.out.println();

System.out.print("★");System.out.print("★");System.out.println();

System.out.print("★");System.out.print("★");System.out.print("★");System.out.println();

System.out.print("★");System.out.print("★");System.out.print("★");System.out.print("★");System.out.println();

............

 

// for ver

for(int j=1; j<=11; j++)

{for(int i=1; i<=j; i++){System.out.print("★");}}

 

// while ver

int j=1

while(j<=11){int i=1; while(i<=j){System.out.print("★"); i++;}j++;}

 

// do while ver

int j=1;

do{int i=1; do{System.out.print("★"); i++;} while(i<=j); j++;}while(j<=11);