古詩詞大全網 - 成語解釋 - VB中 求平均值

VB中 求平均值

假設wendu_i1數組已賦值了(至於怎麽賦值自行解決)

for i=3 to 10

if wendu_i1(1)<wendu_i1(i) then

i1 =wendu_i1(1)

wendu_i1(1)=wendu_i1(i)

wendu_i1(i)=i1

end if

if wendu_i1(2)>wendu_i1(i) then

i1 =wendu_i1(2)

wendu_i1(2)=wendu_i1(i)

wendu_i1(i)=i1

end if

next

這樣後wendu_i1(1)是最大值 ,wendu_i1(2)是最小值

i1=0

for i=3 to 10

i1=i1+wendu_i1(i)

next

i1=i1/8

print i1