Home > Software engineering >  Which big help this vb code, thank you very much
Which big help this vb code, thank you very much

Time:11-20

Write a function for 1 + 2 +... + k, click, click time use imputbox input m.n value, call the function to calculate y, with a text box, according to 3 decimal places, y=(1 + 2 +... M)/(1 + 2 +... + nn)

CodePudding user response:

The last more than dozen, sorry n

CodePudding user response:

Write a function for 1 + 2 +... + k, click calculate, click event use inputbox input m.n value, call this function to calculate y, with a text box, according to 3 decimal places, y=(1 + 2 +... M)/(1 + 2 +... + n)
Is that right?

CodePudding user response:

Write well, code is as follows:
 
Option Explicit

Private Sub Command1_Click ()
Dim m As Long
M=InputBox (m="")

Dim n As Long
N=InputBox (n="")

Dim m_sum As Long
M_sum=0

Dim As Long I
For I=1 To m
M_sum=m_sum + I
Next

Dim n_sum As Long
N_sum=0

For I=1 To n
N_sum=n_sum + I
Next

Dim As Double y
Y=m_sum/n_sum

Text1. Text=Format (y, "0.000")
End Sub

Run the example:

Download address:
Link: https://pan.baidu.com/s/1OsA1YHiQs3Jh9s4j5D2SUQ
The extracted code: fto5

CodePudding user response:

Simplify
 
Private Sub Command1_Click ()
Dim m As Long
M=InputBox (m="")
Dim n As Long
N=InputBox (n="")

Text1. Text=Format (((1 + m) * m)/(n) (1 + n) *, "0.000")

End Sub

CodePudding user response:

references 4 floor crispy ice cream response:
simplify
 
Private Sub Command1_Click ()
Dim m As Long
M=InputBox (m="")
Dim n As Long
N=InputBox (n="")

Text1. Text=Format (((1 + m) * m)/(n) (1 + n) *, "0.000")

End Sub

Thank you very much help, thank you
  • Related