vb求和問題

時間 2022-07-15 09:10:07

1樓:stormy暖

private sub command1_click()dim i as integer, s as integers = 0

for i = 1 to 100

s = s + i

next i

print 「s=」s

end sub

2樓:充修齊

private sub form_click()dim i as integer, s as integeri = 0

s = 1

do while

i = i + s

s = s + 1

print "1+2+3...+100="; send sub

3樓:匿名使用者

next i和end sub之間,插入一條輸出語句:

print s

即:private sub form_click()dim i as integer,s as integers=0for i = 1 to 100

s=s+i

next i

print s

end sub

你是不是缺了private sub form_click() 這一行啊?

4樓:匿名使用者

已經測試過了:

private sub command1_click()dim i as integer, s as integers = 0

for i = 1 to 100

s = s + i

next i

print s

end sub

如果還加乙個textbox按鈕的話,你可以用下面這個在textbox裡隨便輸入乙個數字,就是你要的結果了:

private sub command1_click()dim i as integer, s as doubledim t as integer

t = text1.text

s = 0

for i = 1 to t

s = s + i

next i

print "s ="; s

end sub

private sub form_load()text1.text = ""

end sub

vb6多表多字段求和

select distinct d.考生號,d.班別,d.姓名,select c.成績 from select a.考生號,a.班別,a.姓名,a.考試,a.語文 a.數學 a.英語 b.物理 b.化學 b.生物 as 成績 from a a left join b b on a.考生號 b.考生號...

冪級數求和函式問題,冪級數求和問題

你與佛有緣 1,令an x n n n 1 則 limlan a n 1 l limlxln n 2 lxl 1 令lxl 1故 1 又當x 1時an 1 n n 1 1 n 1 1 n級數收斂,當x 1時,an 1 n 1 n 1 1 n 亦收斂 交錯級數 故收斂區間為 1,1 2,這個題目應該從...

oracle求和問題

select sum a.je as jehj,a.bh as bh,to char a.fkrq q,yyyymm as fkrq from xsb a where to char a.fkrq q,yyyymm to char add months sysdate,2 yyyymm and a....