瀏覽單個文章
FY24FR
Basic Member
 

加入日期: Apr 2007
文章: 19
這不算很難吧?

dim x,i,f as integer
dim pi as double(我不太確定是不是用double還是real...家裡電腦沒裝vb6)
dim strPi as string

x=1
f=-1
pi=0
n=100(或是另外寫介面自行決定n要多少)

for i=1 to n
f=f*f
x=x+2
pi=pi+f*(4/x)
next i

strPi=left(cstr(pi),102)

歡迎指正或修正.
舊 2007-07-07, 10:07 PM #4
回應時引用此文章
FY24FR離線中