Option Explicit
Dim X, S, L As Double
Dim i, j, N, K As Integer
Sub sdgs()
Cells(1, 1) = "Podaj N"
Cells(2, 1) = "Podaj X"
Cells(3, 1) = "Wynik:"
N = Cells(1, 2).Value
X = Cells(2, 2).Value
S = 0
For i = 1 To N - 1 Step 1
K = 1
For j = 1 To i Step 1
K = K * j
Next j
L = 6# ^ X
S = S + ((X ^ i) * (Log(6#) ^ i)) / K
Next i
If N = 1 Then Cells(3, 2) = 1
If N > 1 Then Cells(3, 2) = S + 1
End Sub
MOJE
Option Explicit
Dim X, S, w, a As Double
Dim i, j, N, K As Integer
Sub kp()
Cells(1, 1) = "wartość n"
Cells(2, 1) = "wartość x"
Cells(3, 1) = "wynik:"
N = Cells(1, 2).Value
X = Cells(2, 2).Value
S = 0
N = 1
a = 1
For i = 1 To N + 1 Step 1
K = 1
For j = 1 To i Step 1
K = K * j
Next j
w = 2# ^ X
S = a + ((X ^ i) * (Log(2#)) ^ i) / K
Next i
If N = 1 Then Cells(3, 2) = 1
If N < 100 Then Cells(3, 2) = S + 100
End Sub