有以下为代码: s=0 for i = 1 to 10 step 2 s = s + i endfor output s 输出的结果是________________。
举一反三
- 有如下程序段:s = 0For i = 1 To 10 s = s + iNext iPrint s与上述程序段输出结果相同的程序段为( )。 A: s = 0: i = 0 While i <= 10 i = i + 1 s = s + i Wend Print s B: s = 0: i = 1 While i < 10 i = i + 1 s = s + i Wend Print s C: s = 0: i = 1 Do s = s + i i = i + 1 Loop While i < 10 Print s D: s = 0: i = 1 Do s = s + i i = i + 1 Loop Until i > 10 Print s
- 下列程序执行后,内存变量 S 的值是 ________ 。 CLEAR S=0 FOR I=10 TO 100 STEP 10 S=S+I ENDFOR ?S
- 以下能正确计算1*2*3*......*10的程序段是________. A: for(i=1;i<10;i++)s=s*i;s=1; B: s=0;for(i=1;i<=10;i++)s=s*i; C: for(i=1;i<10;i++)s=s*i;s=0; D: s=1;for(i=1;i<=10;i++)s=s*i;
- 存在程序段: s=0 For i=1 to 10 step 2 s= s + 1 i= i * 2 Next i 当循环结束后,变量i ,s 的值分别为().
- 有一段程序: a = Array(1, 2, 3, 4, 5, 6): s =1: For i = 5 To 1 Step -2: s = s * a(i): Next I, 执行后,s的结果是