For i = 1 To 4
s = s * 10 + a(i)
Next i
'对于数组a,为a(0)=1, a(1)=3, a(2)=5, a(3)=7, a(4)=9
'i=1时, s = s * 10 + a(1) = 0 * 10 + 3 = 3
'i=2时, s = s * 10 + a(2) = 3 * 10 + 5 = 35
'i=3时, s = s * 10 + a(3) = 35 * 10 + 7 = 357
'i=4时, s = s * 10 + a(4) = 357 * 10 + 9 = 3579
'在整个For循环中, 类似于作如下操作(其实s等于0,相当于根本就用不上了)
'i=1时,s1 = s * 10 + a(1) = 0 * 10 + a(1) = a(1)
'i=2时,s2 = s1 * 10 + a(2) = a(1) * 10 + a(2)
'i=3时,s3 = s2 * 10 + a(3) = (a(1) * 10 + a(2)) * 10 + a(3) = a(1) * 100 + a(2) * 10 + a(3)
'i=4时,s4 = s3 * 10 + a(4) = (a(1) * 100 + a(2) * 10 + a(3)) * 10 + a(4) = a(1) * 1000 + a(2) * 100 + a(3) * 10 + a(4)
'就相当于从千位数到个位数,分别是a(1)、a(2)、a(3)、a(4),就等于3579了© 2017-2019 超级试练试题库,All Rights Reserved.