카테고리1

Chrome (1) GAME (2) HTML (3) Internet Explore (1) Movie (1) TIP (2) Windows (2) java (51) 건강 (1) 맛집 (1)

Post List

2017년 2월 27일 월요일

java]for문을 while 문으로 변경

for(int i = 0; i<=10; i++){
for (int j=0; j<=i; j++){
System.out.print("*"); }
System.out.println(i);
}

위의 내용을 while문으로 변경해보자.

  int i = 0;
while (i<=10) {
int j=0;
while (j<=i) {
System.out.print("*");
j++;
}
System.out.println(i);
i++;
}

댓글 없음:

댓글 쓰기