1樓:匿名使用者
第一個文字框(要求填入多少由你決定)
for i = 1 to text1.textb = b +i
next i
text2.text= b
將結果輸出到文字框二
2樓:鬱渟
sub test()
dim i as integer, x as double, y as double
x = 1
y = 0
for i = 1 to 20
x = x * i
y = y + x
next
msgbox y
end sub
3樓:牛人影視
privae sub command1_click()dim i as integer,s as longfor i=1 to 20
s=s+jc(i)
next i
msgbox s
end sub
private function jc(x as integer) as long
dim i as integer
jc=1
for i=1 to x
jc=jc*i
next i
end function
4樓:匿名使用者
n=20
s=0j=1
for i= 1 to n
j=j*i
s=s+j
next
msgbox s
5樓:匿名使用者
樓下的 回答 都挺好的.. 就是靠迴圈哦~~
vb程式設計計算:1+2!+3!+...+10!
6樓:匿名使用者
private sub command1_click()dim i as integer, j as integerdim l as long, h as longfor i = 1 to 10
h = 1
for j = 1 to i
h = h * j
next
l = l + h
next
print l
end sub
7樓:岔路程式緣
private sub form_click()
form1.autoredraw = true
me.show
dim sum as long, i as integer, j as integer
sum = 0
for i = 1 to 10
sum = sum + jc(i)
next
print "s=1+2!+3!+...+10!="; sum
end sub
private function jc(x as integer) as long
if x = 1 then jc = 1 else jc = x * jc(x - 1)
end function
或(do while loop ):
private sub form_click()
form1.autoredraw = true
me.show
dim sum as long, i as integer, j as integer
sum = 0
i=1do while i <= 10
sum = sum + jc(i)
i=i+1
loop
print "s=1+2!+3!+...+10!="; sum
end sub
private function jc(x as integer) as long
if x = 1 then jc = 1 else jc = x * jc(x - 1)
end function
8樓:亓靖瀅
dim i as integer
dim sum as integer
dim n as integer
n = 1
sum = 0
for i = 1 to 10
n = n * i
sum = sum + n
next
print(sum)
9樓:宿思敏羿宣
vb程式設計計算2+2^1+2^2+2^3+......+2^10private
subcommand1_click()
dimi%,s%s
=2fori=1
to10s=
s+2^
inext
iprint
send
subvb程式設計求出100-200以內的同時能被3和5整除的所有整數private
subcommand1_click()
dimi
asinteger
fori
=100
to200ifi
mod3=0
andi
mod5=0
then
i;end
ifnext
iend
subvb程式設計計算1-2+3-4+5-6……+-n,其中n由文字框輸入
private
subcommand1_click()
dimi%,
k%,s%k=
1fori=
1toval(text1.text)s=
s+i*
kk=-k
next
iprint
sendsub
用vb求1!+2!+3!+……+10!的結果。
10樓:匿名使用者
樓上有幾個錯誤!定義的整型變數數值或溢位,最後一行的標籤也輸錯了!回我已改正,並已執行無誤
答private sub command1_click()dim i as integer
dim sum as long
dim n as long
n = 1
sum = 0
for i = 1 to 10
n = n * i
sum = sum + n
next
label1.caption = sum
end sub
11樓:匿名使用者
dim n%,sum%,i%
n = 1
sum = 0
for i = 1 to 10
n = n * i
sum = sum+n
next
label1.caption=cstr(sum)
12樓:匿名使用者
dim i as integer
dim sum as integer
dim n as integer
n = 1
sum = 0
for i = 1 to 10
n = n * i
sum = sum + n
next
lebel1.caption=cstr(sum)
13樓:匿名使用者
private sub command1_click()dim sum as long
for i = 1 to 10
sum = sum + jc(i)
next
me.label1.caption = sumend sub
private function jc(byval i as integer) as long
dim j as integer, cj as longcj = 1
for j = 1 to i
cj = cj * j
next
jc = cj
end function
用vb程式計算1!+2!+3!+4!+5!的值
14樓:聽不清啊
private sub command1_click()s = 0
t = 1
for i = 1 to 5
t = t * i
s = s + t
next i
print "1!+2!+3!+4!+5!="; send sub
VB程式設計。啊啊啊。急求
private sub command1 click dim gs as integer gs 0 for i 1 to 20 for j 1 to 100 5 ik 100 i j if 5 i j 0.5 k 100 thengs gs 1 print i 張5元 j 張1元 k 張5毛 end...
求vb的求數平方的程式設計,求一個vb的求一個數平方的程式設計
樓主您好!什麼也不用畫,直接複製貼上 簡單就一句 msgbox 這個數的平方為 val inputbox 請輸入要求平方的數 提示視窗 2 64 vbokcancel vbdefaultbutton1,提示視窗 多寫點就這樣 dim number1 as double dim number2 as ...
vb程式設計的問題,求解答謝謝了。定義10 10的二
private sub command1 click dim a 1 to 10,1 to 10 as integer,ssj as long,xsj as long clsrandomize for i 1 to 10 for j 1 to 10 a i,j int rnd 90 10 print...