import org.w3c.dom.ls.LSOutput;
public class _11_Continue {
public static void main(String[] args) {
//Continue
//์นํจ ์ฃผ๋ฌธ ์๋์ค์ ๋
ธ์ผ ์๋์ด ์๋ค๊ณ ๊ฐ์
//for๋ฌธ
int max = 20; //์ต๋ ์นํจ ํ๋งค ์๋
int sold = 0; //ํ์ฌ ์นํจ ํ๋งค ์๋
int noshow = 17; //๋๊ธฐ๋ฒํธ 17๋ฒ ์๋์ด ๋
ธ์ผ
for (int i=1; i <= 50; i++){
System.out.println(i+"๋ฒ ์๋, ์ฃผ๋ฌธํ์ ์นํจ ๋์์ต๋๋ค.");
//์๋์ด ์๋ค๋ฉด? (noShow)
if(i == noshow){
System.out.println(i+"๋ฒ ์๋, ๋
ธ์ผ๋ก ์ธํด ๋ค์ ์๋์๊ฒ ๊ธฐํ๊ฐ ๋์ด๊ฐ๋๋ค.");
continue;
}
sold++; //ํ๋งค ์ฒ๋ฆฌ
if(sold == max){
System.out.println("๊ธ์ผ ์ฌ๋ฃ๊ฐ ๋ชจ๋ ์์ง๋์์ต๋๋ค.");
break;
}
}
System.out.println("์์
์ ์ข
๋ฃํฉ๋๋ค.");
System.out.println("-------------");
//while๋ฌธ
sold = 0;
int index = 1; //์๋ ๋ฒํธ
while( index <= 50){
System.out.println(index + "๋ฒ ์๋, ์ฃผ๋ฌธํ์ ์นํจ ๋์์ต๋๋ค.");
//์๋์ด ์๋ค๋ฉด(noshow)
if (index == noshow){
System.out.println(index +"๋ฒ ์๋, ๋
ธ์ผ๋ก ์ธํด ๋ค์ ์๋์๊ฒ ๊ธฐํ๊ฐ ๋์ด๊ฐ๋๋ค.");
index++;
continue;
}
sold++;//ํ๋งค ์ฒ๋ฆฌ
if(sold == max){
System.out.println("๊ธ์ผ ์ฌ๋ฃ๊ฐ ๋ชจ๋ ์์ง๋์์ต๋๋ค.");
break;
}
index ++;
}
System.out.println("์์
์ ์ข
๋ฃํฉ๋๋ค.");
}
}