下列程序中输出结果为5050的是
A: s=0for i in range(100,-1): s=s+iprint(s)
B: s=0for i in range(100,1,-1): s=s+iprint(s)
C: s=0for i in range(100): s=s+iprint(s)
D: s=0for i in range(101): s=s+iprint(s)
A: s=0for i in range(100,-1): s=s+iprint(s)
B: s=0for i in range(100,1,-1): s=s+iprint(s)
C: s=0for i in range(100): s=s+iprint(s)
D: s=0for i in range(101): s=s+iprint(s)
举一反三
- 请写出如下程序的执行结果。s = 0for i in ran... s = s + iprint(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
- 以下能计算1-20所有奇数之积的是: A: s=1for i in range(1,21,2): s=s*i B: s=0for i in range(1,21,2): s=s*i C: s=1for i in range(0,20,2): s=s*i D: for i in range(1,21,2): s=1 s=s*i
- 阅读程序,输出结果: s=0 for i in range(1,101): s = s + i print('1+2+3+…+100 = ', s)
- 下面程序段的运行结果是____。s = 1: sum = 0For i = 1 To 4 s = s * i sum = sum + sNext iPrint sum A: 24 B: 33 C: 10 D: 30