1 / 6

반복구조 1 부터 10 까지 합계를 구하시오

ex6_1.html. var i, sum=0 for(i=1; i<=10; i++) { sum = sum + i }. START. 반복구조 1 부터 10 까지 합계를 구하시오. i 1, sum 0. NO. i <= 10. YES. sum sum + i. i i + 1. sum. STOP. ex6_2.html. var n, sum=0 for(n=1; sum<=100; n++) { sum = sum + n }.

corin
Télécharger la présentation

반복구조 1 부터 10 까지 합계를 구하시오

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ex6_1.html var i, sum=0 for(i=1; i<=10; i++) { sum = sum + i } START • 반복구조 1부터 10까지 합계를 구하시오 i 1, sum 0 NO i <= 10 YES sum sum + i i i + 1 sum STOP

  2. ex6_2.html var n, sum=0 for(n=1; sum<=100; n++) { sum = sum + n } 1부터 n까지의 수를 누적하여 합계가 100 이 넘었을 때의 n 값과 합계를 구하시오 START n 1, sum 0 NO sum <= 100 YES sum sum + n n n + 1 n, sum STOP

  3. var i, sum=0 for(i=1; i<=10; i++){ if ((i%2) == 0) sum=sum+i } ex6_3.html START 1부터 10까지 짝수의 합계를 구하시오 i 1, sum 0 NO i <= 10 YES NO i % 2 == 0 YES sum sum + i i i + 1 sum STOP

  4. ex6_5.html var i, esum=0, osum=0 for(i=1; i<=10; i++){ if ((i%2) == 0) esum = esum + i else osum = osum + i } 1부터 10까지 짝수와 홀수의 합계를 구하시오

  5. START i 1, esum=0 osum 0 NO i <= 10 YES NO YES i % 2 == 0 YES osum osum + i esum esum + i i i + 1 esum, osum STOP

  6. var i, sum=0 for(i=0; i<=10; i=i+2){ sum=sum+i } ex6_4.html START 1부터 10까지 짝수의 합계를 구하시오 i 0, sum 0 NO i <= 10 YES sum sum + i i i + 2 sum STOP

More Related