1樓:小羅哥
option explicitdim k, t as singleprivate sub ***mand1_click()for k = 2 to 300 step 2t = t + 1 / k
next
label1.caption = t
end sub
2樓:匿名使用者
for i = 2 to 300 step 2
sum = 1 / i + sum
next i
vb試題程式設計計算1-1/2+1/3-1/4+...+1/99-1/100
3樓:
1:dim i as integer
dim s as double
dim s0 as double
for i = 1 to 100
s0 = 1 / i
if i mod 2 = 0 then s0 = s0 * (-1)s = s + s0
next
print s
2:dim i as integer
dim s as double
for i = 1 to 100 step 2s = s + 1 / i - 1 / (i + 1)next
print s
3:dim i as integer
dim s as double
i = 1
do until i >= 100
s = s + 1 / i - 1 / (i + 1)i = i + 2
loop
print s
4:dim i as integer
dim s as double
for i = 1 to 100
select case i mod 2
case 0
s = s - 1 / i
case 1
s = s + 1 / i
end select
next
print s
用vb編寫計算s=1-1/2+1/3-1/4+1/5-1/6+1/7-1/8+1/9-1/10
4樓:匿名使用者
private sub ***mand1_click()dim i as integer, s as doubles = 0
for i = 1 to 10
s = s + (-1) ^ (i - 1) * (1 / i)next i
print 0; s
end sub
編寫程式,計算s
下面是你的 修改後並能成功執行的 include main printf s 6f n s getchar getchar 錯誤1.maim改為 main 錯誤2.for迴圈沒加花括號,沒括號只迴圈for接下來的那句。錯誤3.a t不能是整型,至少t不能是整型,想想看,若a t是整型會造成s也是整型...
用C語言編寫程式,用C語言編寫程式?
程式就是讀取檔案到陣列,再將陣列進行排序,最後寫入檔案。讀寫檔案流程 fopen獲取檔案流 根據讀寫需求,選擇引數,使用完必須呼叫fclose函式關閉 fscanf讀取檔案內容,fseek控制檔案流指標,fprintf寫入檔案。選擇排序 每個迴圈週期選出一個最值,交換一次。下面是 陣列為動態陣列 i...
c語言編寫程式計算並輸出,C語言。編寫程式計算並輸出 1 12 123 1234 的前n 設0 n 10 項的和,n從鍵盤輸入。
4歲的帥帥最近感冒了,伴發高燒,流清鼻涕,光波爐菜譜,早晚咳嗽不停,在醫院打了兩天吊針,服過退燒藥和止咳藥,約5天孩子感冒好了,不發燒也不流鼻涕,就是咳嗽不見減輕。事實上,當感冒急性期症狀消失後,咳嗽仍遷延不愈,臨床上稱之感冒後咳嗽。感冒後咳嗽多見7歲以下小兒,症狀表現為剌激性乾咳或咳少量白色黏液痰...