[單項(xiàng)選擇題] 下列程序的運(yùn)行結(jié)果為_(kāi)_____。Private Sub Command1_ Click() Dim s As Long Dim x As
2021-07-20
[單項(xiàng)選擇題] 下列程序的運(yùn)行結(jié)果為_(kāi)_____。
Private Sub Command1_ Click()
Dim s As Long
Dim x As Integer
s = 0
for x = 99 To 1 step - 2
s=s+ x
Next x
Print s
End Sub
A.100
B.500
C.2500
D.5000
正確答案:C
參考解析:單循環(huán)次數(shù)“r=int((終值-初值+步長(zhǎng))/步長(zhǎng))”。計(jì)算結(jié)果是將1~100內(nèi)的奇數(shù)相加。
詞條內(nèi)容僅供參考,如果您需要解決具體問(wèn)題
(尤其在法律、醫(yī)學(xué)等領(lǐng)域),建議您咨詢(xún)相關(guān)領(lǐng)域?qū)I(yè)人士。