1樓:聽不清啊
照樓主的題目,n不是大於1的正整數,應該是大於回1的正偶數才對答吧?
private sub ***mand1_click()n = val(inputbox("n="))if n mod 2 = 1 then exit subt = 1 / 2
s = t
for i = 3 to n - 1 step 2t = t * i * (i - 1) * (i - 1) / (i + 1)
s = s + t
next i
print s
end sub
2樓:可軒
private sub ***mand1_click()dim j%, k%, n%, m#, s#n = inputbox("n=?")
s = 0
for j = 2 to n
m = 1
for k = 1 to j - 1
m = m * k
next k
s = s + m / j
next j
clsprint "結果是"; s
end sub
3樓:
function out(n)
for i=1 to n
baiout=out+cj(i-1)/i
next
end function
function cj(n)
for i=1 to n
cj=n*i
next
end function
for n=1 to 5
隨便du寫的
zhi 對不對不曉dao得回
你自己答算
4樓:李清塵
private b,n as intergerprivate function jc(m as interger) as interger
jc = 1
if m > 1 then
for i = 1 to m
jc = jc * i
next i
end if
end function
private sub text1_keydown(keycode as integer, shift as integer)
n = text1.text
if keycode = 13 then
for j = 1 to n
b = b + jc(j) / j
next j
end if
msgbox b , vbok + vbinformation , "輸出"
end sub
vb程式設計 1、 程式設計計算s=1/1!+1/2!+1/3!+…..+1/n! ,n的值通過inputbox從鍵盤輸入,計算結果在窗體上輸
5樓:
^private sub ***mand1_click()dim i as integer, j as integer, n as integer
dim sum1 as long, sum2 as longn=inputbox("請輸入n的值")
sum1 = 0
sum3=1
for i = 1 to n
sum2 = 1
for j = 1 to i
sum2 = sum2 * j
sum3=sum2^(-1)
next j
sum1 = sum1 + sum3
next i
label1.caption = label1.caption + str(sum1)
end sub
需要一個button 和一個lable,結專果在lable上顯示屬
VB程式程式設計,什麼是VB程式設計?
private sub command1 click dim t x y z t val text1.text if t 100 or len text1.text 3 then msgbox 輸入的數字不符合要求 vbinformation exit sub end if z t mod 10 y...
VB程式設計題急急急
稍等!好了!把視窗拉大一點以方便在視窗上顯示內容,不用控制元件,點選視窗即可執行,如下 dim f 20,12 as single,max as single,min as single dim i as integer,j as integer,gd 2,10 as integer private...
vb程式設計check選擇設計
private sub command1 click dim s as string if check1.value vbchecked thens check1.caption end if if check2.value vbchecked thens s check2.captionend i...