Hola estoy intentado hacer esta serie= pi^3/32=1-1/3¡+1/5¡-1/7¡+1/9¡...... Dim n As Integer
Dim i As Integer
Dim p As Integer
Dim q As Integer
Dim a As Double
Dim b As Double
Dim expo1 As Double
Dim expo2 As Double
Dim pi As Double
'proceso
n = Val(TextBox1.Text)
a = 1
b = 1
i = 1
p = 1
q = 0
expo1 = 0
expo2 = 0
Do While i <= n
If i Mod 2 = 0 Then
b = b / ((i + p) ^ 3))
p = p + 2
expo2 = expo2 + b
b = 1
Else
a = a * (1 / ((i + q) ^ 3))
q = q + 2
expo1 = expo1 + a
a = 1
End If
i = 1 + 1
Loop
pi = expo1 - expo2
'salida
Label3.Text = Str(pi)
End Sub
me podrian ayudar por que me sale eso o si se puede hcer de una manera mas facil ayuda porfavor
Dim i As Integer
Dim p As Integer
Dim q As Integer
Dim a As Double
Dim b As Double
Dim expo1 As Double
Dim expo2 As Double
Dim pi As Double
'proceso
n = Val(TextBox1.Text)
a = 1
b = 1
i = 1
p = 1
q = 0
expo1 = 0
expo2 = 0
Do While i <= n
If i Mod 2 = 0 Then
b = b / ((i + p) ^ 3))
p = p + 2
expo2 = expo2 + b
b = 1
Else
a = a * (1 / ((i + q) ^ 3))
q = q + 2
expo1 = expo1 + a
a = 1
End If
i = 1 + 1
Loop
pi = expo1 - expo2
'salida
Label3.Text = Str(pi)
End Sub
me podrian ayudar por que me sale eso o si se puede hcer de una manera mas facil ayuda porfavor