ÀÚ¹Ù ±¸±¸´Ü ÇÁ·Î±×·¡¹Ö Áú¹®Çϳª ÀÖ½À´Ï´Ù.

   Á¶È¸ 1664   Ãßõ 0    

1901;팔리면 1656;문Ȣ16;1648; 맙시다. 소1473;한 NJ13;변 댓글1012; 삭1228;Ȣ16;lj16;,148; ǥ12;-124;러운 1068; 1077;니다 

1088;0148;를 ᇺ117;1004;/196; 공ǥ12;Ȣ16;고 1080;습니다.

프/196;그래0141;1012; 시1089;Ȣ16;기 1204;에 우선 순서도를 그/140;보고 1312;,148;문1012; Ǻ12;떻,172; 0176;치해야 할1648; 고0124;Ȣ16;고 1080;습니다.


1. 1204;형1201;1064; nested for문1004;/196; 1676;본 코드 1077;니다.


&#160; &#160; &#160; &#160; for(int i = 2; i<=9; i++) {

&#160; &#160; &#160; &#160; &#160; &#160; for(int k = 1; k<=9; k++) {

&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; int result = i * k;

&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; System.out.println(result);

&#160; &#160; &#160; &#160; &#160; &#160; }

&#160; &#160; &#160; &#160; }

2. 1060;,163;1008; 1228;가 한번 1676;본 코드 1077;니다.

&#160; &#160; &#160; &#160; int j = 1;

&#160; &#160; &#160; &#160; int sum = 0;

&#160; &#160; &#160; &#160; for(int i = 2; i<=9; i++) {

&#160; &#160; &#160; &#160; &#160; &#160; while(j<=9) {

&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; sum = i * j;

&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; System.out.println(i + " x "+j+ " = "+sum);

&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; j = j+2;

&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; if(j == 11) {

&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; j = 1;

&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; break;

&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }

&#160; &#160; &#160; &#160; &#160; &#160; }

&#160; &#160; &#160; }

1656;문1) if( j == 11) { j =1; break} 1060; 1312;,148;1060; 1080;1004;니 프/196;그래0141;1060; 1228;대/196; 돌아갑니다. &#160;디버ƾ13;1012; 해보니 j값1060; 계속 111012; 유1648;Ȣ16;고 1080;Ǻ12;서 구구단1032; 3단1004;/196; 넘Ǻ12;가1656; 않더군요. for문1008; k가 9에서 101004;/196; 넘Ǻ12;가면서 루프 벗Ǻ12;나면서 i값1060; 31004;/196; 1613;가Ȣ16;면서 k값1060; 초기화 .104;lj16;,144; 같더군요.

1060;런ǥ12;ǥ16;1060; for문과 while문1032; 차1060;1064;가요?


1656;문2) for문과 while문1032; 순서도lj16; 같1008;가요? 아니면 다른가요?


1060;,163;1200;,163; 차근차근 해보고 1080;습니다. Ǻ12;떠한 1032;견도 감사합니다.

ªÀº±Û Àϼö·Ï ½ÅÁßÇÏ°Ô.
extra 2023-06
j = j+2;
=> j = j + 1;
·Î º¯°æÇÏ¼Å¾ß ÇÕ´Ï´Ù.
À§¿Í ¾Æ·¡´Â Áõ°¨ ºÎºÐÀÌ ´Þ¶ó ¼­·Î µ¿ÀÛÀÌ ¹Ì¹¦ÇÏ°Ô ´Þ¶óÁý´Ï´Ù.

¾Æ·¡ ¼Ò½º´Â Á¦´ë·Î ¼öÇàµË´Ï´Ù.
https://ideone.com/a6ql60
¾Æ¸¶ °á°ú°¡ ÀÌ»óÇÑ °ÍÀº À߸ø ¼öÇàµÇ¾î¼­ ±×·± µí ½Í½À´Ï´Ù.

Áú¹® 1¿¡ ´ëÇÑ ´äÀº ¹Ýº¹¹®ÀÇ Â÷À̶ó±â º¸´Ü ÇÁ·Î±×·¥ Äڵ带 Àß ¸ø ¼öÁ¤Çϼż­ ±×·± µí ½Í½À´Ï´Ù.
ÀÌ ºÎºÐÀº ¿ø·¡ÀÇ Äڵ带 ¸ð¸£´Â »óȲ¿¡¼± °íÄ¥ ¼ö ¾ø½À´Ï´Ù.
±×¸®°í ´äº¯À» µå¸®ÀÚ¸é ¼ø¼­µµ¿¡¼­´Â ±»ÀÌ for ¹®ÀÎÁö while ¹®ÀÎÁö ±¸ºÐÇÏÁö ¾Ê½À´Ï´Ù.
¼ø¼­µµ ±×¸®´Â °Íµµ ¾à°£ÀÇ Â÷ÀÌ°¡ À־ ±¸ºÐÀ» ÁöÀ» ¼ö ÀÖ±ä ÇÏÁö¸¸ ÀϹÝÀûÀ¸·Î ¹Ýº¹µÇ´Â °É °í·ÁÇϸé Â÷ÀÌ°¡ ¾ø½À´Ï´Ù. ´Ü¼øÈ÷ Á¶°Ç¹®¿¡ µû¶ó ´õ ¹Ýº¹ÇÒÁö ¾ÈÇÒÁö¸¸ ±¸ºÐµË´Ï´Ù.
     
inquisitive 2023-06
°¨»çÇÕ´Ï´Ù.
±¸Â÷´Ï 2023-06
for´Â ÀϹÝÀûÀ¸·Î Ƚ¼ö¸¦ È®½ÇÈ÷ ¾Ë ¶§ »ç¿ëÇÕ´Ï´Ù.
whileÀº ±â¾à¾øÀÌ µ¹¸®´Ù°¡ Á¶°Ç¿¡ ÀÇÇؼ­ Á¾·áÇÒ¶§ »ç¿ëÇÕ´Ï´Ù.

¹°·Ð ¹®¹ýÀûÀ¸·Î µÎ°³ Å°¿öµå°¡ µ¿µîÇÏ°Ô »óÈ£ º¯È¯ÀÌ °¡´ÉÇϱ⠶§¹®¿¡
Â¥´Ù º¸¸é ¾î¶²°É ¾²´ø »ó°üÀº ¾ø½À´Ï´Ù¸¸, À¯Áöº¸¼ö ½±µµ·Ï °¡µ¶¼ºÀ» °í·ÁÇÏ´Â°Ô ÁÁ½À´Ï´Ù.
     
inquisitive 2023-06
°¨»çÇÕ´Ï´Ù.
¹«¾Æ 2023-06
À§¿¡ ºÐµéÀÌ Àß ¼³¸íÀ» ÇØÁּ̰í
Á¶°Ç¿¡ ÀÇÇØ ·çÇÁ¸¦ Å»ÃâÇÏ°Ô ¸¸µé ¶§´Â
if(j == 11)
ÀÌ·± ¹æ¹ý º¸´Ù´Â
if(j >= 11)
ÀÌ·± ¹æ¹ýÀÌ ÁÁ½À´Ï´Ù.
¿ÖÀÎÁö´Â ¾Ë°ÚÁÒ?

±×¸®°í º¯¼ö¸íµµ Àß Á¤ÇØÁà¾ß µð¹ö±ëÀÌ ÆíÇÕ´Ï´Ù.
sum º¸´Ù´Â mul °°Àº À̸§ÀÌ ÁÁ°ÚÁÒ.
     
inquisitive 2023-06
º¯¼ö¸í ¸íÈ®ÇÏ°Ô »ç¿ëÇØ¾ß °Ú³×¿ä.
°¨»çÇÕ´Ï´Ù.
while(j<=9)

ÀÌ°Å ÀÚü°¡ µ¿ÀÛ Á¶°ÇÀÌ°í ±× ¸»À» ´Þ¸® Çؼ®Çϸé Å»Ãâ Á¶°Çµµ µË´Ï´Ù.
±»ÀÌ ¹Ø¿¡ Å»Ãâ Á¶°ÇÀ» ¾È³Ö¾îµµ µÈ´Ù´Â°ÅÁÒ.

Áï, if(j == 11) { j = 1; break; } ÀÌ ±¸¹®ÀÌ ¾ø¾îµµ µË´Ï´Ù.
     
¹«¾Æ 2023-06
Àú Äڵ尡... Á»..
j¸¦ ÃʱâÈ­ ÇÏ´Â µ¥°¡ ¾ø¾î¼­ »© ¹ö¸®¸é ´ÙÀ½ÆÇ ºÎÅÍ´Â ²Î µÇ¾î¹ö¸³´Ï´Ù.
          
³× i ¿µ¿ª ¾È¿¡ j ÃʱâÈ­°¡ ÀÖ¾î¾ß Çϴµ¥ ±×°Ô ¾ø±º¿ä.
               
inquisitive 2023-06
ÈùÆ® Áּż­ °¨»çÇÕ´Ï´Ù.
´Ù½Ã Çѹø Çغ¸°Ú½À´Ï´Ù.
¹«¾Æ 2023-06
if(j == 11)
¸¦
if(j > 9) ¶Ç´Â if(j > 10)
·Î ¹Ù²Ù¼¼¿ä.
     
inquisitive 2023-06
°¨»çÇÕ´Ï´Ù.
Á¶±Ý °íÃĵ帮¸é.. j ÃʱâÈ­ ±¸¹®À» ²À while ¹® ¾È¿¡ ³ÖÁö ¾ÊÀ¸¼Åµµ µË´Ï´Ù. Á¶°Ç ºÙÀÌ¸é ±æ¾îÁö°í¿ä.
j=j+2 ¸¦ j+1 ·Î ¼öÁ¤Çϸé, ±âÁ¸ ÇÁ·Î±×·¥Àº 2´Ü¸¸ ³ª¿À´øµ¥, ±× °æ¿ì À­ºÐµé ¸»¾¸Ã³·³ j==11 Á¶°ÇÀ» j >= 10 Á¶°ÇÀ¸·Î ¹Ù²ãµµ ³ª¿À±ä ÇÏÁö¸¸,
°£´ÜÇÑ°Ô ÁÁ°ÚÁö¿ä.

int j = 1;

int sum = 0;

for(int i = 2; i<=9; i++) {
j=1;
while(j<=9) {

sum = i * j;

System.out.println(i + " x "+j+ " = "+sum);

j = j+1;

}

}
     
inquisitive 2023-06
±ò²ûÇϳ׿ä.
ÀÌÀü¿¡ ÀÌÁßfor¹® ÀÌ·± ¹®Á¦ °Þ¾ú´Âµ¥
ÀÌ·¸°Ô ÇØ°áÇÏ¸é µÇ°Ú³×¿ä.
°¨»çÇÕ´Ï´Ù.
¼º±â»ç 2023-06
>= º¸´Ù´Â > ¸¦ ¾²¼¼¿ä.
     
inquisitive 2023-06
ÂüÁ¶ÇÏ°Ú½À´Ï´Ù.
°¨»çÇÕ´Ï´Ù.


QnA
Á¦¸ñPage 237/440
2023-06   1543   °Ü¿ï³ª¹«
2023-06   1313   ¿µ»êȸ»ó
2023-06   1304   »ç¶ûÇ϶ó
2023-06   1370   Çã¾î
2023-06   1850   ÀüÁø
2023-06   2254   Ã᾿½º
2023-06   1665   inquisitive
2023-06   2687   ±ä¸Ó¸®·çÀ̽º
2023-06   1895   ÀÌÈñÁÖ
2023-06   1659   slowcity
2023-06   1567   °ú°ÅÇÕ°Ý
2023-06   1319   ¹«¾Æ
2023-06   1482   ºí·ç¿µ»ó
2023-06   1538   Ãֽÿµ
2023-06   2530   ¼úÀÌ
2023-06   1979   ű¤¼º
2023-06   2836   Á¤¹«Çö
2023-06   2557   »ßµ¹À̽½ÇÄÀÌ
2023-06   2828   ¹«Á»ÇÔ´ë
2023-06   2229   ĵÀ§µå