第05章

第05ç«&...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
5 第第第第第第第第 5.1 第第第第第第5.2 for第第第while第第 5.3 第第第第第do-while第第 5.4 break第第第continue第第 5.5 第第第第 第第第第第第第第第第──第第 第第第 [Return]
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
5.1 第第第第第第 求 1 求 100 求求求求求 求求求求求求求求求求求“ 1+2+……+100” 求求求求求求求求求求求求求求求求求求求求求 求求求求求求求求求 sum 求求求求求 0 求求求 sum += n 求求求求 n 求求求 1 求 2 求……求 100 求求求求求求求求 3 求 求求求求求 求 1 求求 n 求求求求求 1 求 求 2 求求求求 1 求“ sum += n” 求求 n 求 1 求 求 3 求求 n 求求 101 求求求求求求求求求求 sum 求求求求 1 求 100 求求求求求 求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求 C 求求求求求 3 求求求求求求求求求求求求求求求求求求求求求求 求求求 求求求求求求求求求求求求求求求求求 求 1 求求 for 求求求 求 2 求求 do-while 求求求 求 3 求求 while 求求求
Background image of page 2
求 4 求求 goto 求求求 if 求求求求求求求求求 goto 求求求求求求 1 求 100 求求求求求求求求求求求 main() { int n=1, sum=0; loop: sum += n; n++; if (n<=100) goto loop; printf(“sum=%d\n”, sum); } 求求“ loop:” 求求求求求求求求求求求 : 求求求求求求求求求求求求求求求求求求 goto 求求求求求 goto 求求求求求求求求求求求求求求求求求 求求求求求求 注注 求求求求求求求求求求求求求求求求求 goto 求求求求求求求 goto 求求求求求求求求求求求求求求求求求求求求 求求求求求求求求求 for 求求求求求求求求求求求求求 while 求求求求求求求求求求求求求 [Return]
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
5.2 for 第第第 while 第第 求 3 求求求求求求求 for 求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求求 求求求求求 [ 第第 5.1 ] 求 1 求 100 求求求求求 /* 求求求求求求求求 AL5_1.C*/ /* 求求求求求求 1 求 100 求求求求 */ main() { int i,sum=0; /* 求求求求 sum 求求求求 0*/ for(i=1; i<=100; i++) sum += i; /* 求求求求 */ printf("sum=%d\n",sum); } [ 第第第第 ] 求求求求求求求求求 sum=5050
Background image of page 4
[ 第第 5.2 ] 求 n 求求求 n! 求 n!=1*2*……*n 求求 /* 求求求求求求求求 AL5_2.C*/
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 18

&amp;ccedil;&amp;not;&amp;not;05&amp;ccedil;&amp;laquo;&amp;...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online