...30~100之间能被3和5整除的数8个一行并在标签上显示这些数的和,求...
发布网友
发布时间:2024-07-22 12:58
我来回答
共5个回答
热心网友
时间:2024-08-02 02:37
Private Sub Command1_Click()
For i = 30 To 100 Step 15
j = j + 1
s = s + i
Print i;
If j Mod 8 = 0 Then Print
Next i
Label1.Caption = "30~100之间能被3和5整除的数的总和 = " & s
End Sub
热心网友
时间:2024-08-02 02:36
dim a,i as integer
for i =0 to 100
if mod(i/3)=0 then
a=a+i
next i
其中a为能被3整除的数之和
热心网友
时间:2024-08-02 02:28
可以使用循环往标签上输出,每输出 8 个数字就换行,并且使用变量来保存这些数字的和。代码如下:
Dim sum As Integer = 0
Dim count As Integer = 0
For i = 30 To 100
If i Mod 3 = 0 AndAlso i Mod 5 = 0 Then
Label1.Text = Label1.Text & i & " "
sum = sum + i count = count + 1 If
count Mod 8 = 0 Then Label1.Text = Label1.Text & vbCrLf
End If
Next
Label1.Text = Label1.Text & vbCrLf & "这些数字的总和是:" & sum
热心网友
时间:2024-08-02 02:32
Private Sub form_click()
Dim sum
sum = 0
For i = 1 To 100
If i Mod 3 = 0 Then
sum = sum + i
End If
Next i
Print sum
End Sub
热心网友
时间:2024-08-02 02:33
dim a,i as integer
for i =0 to 99 step 3
a=a+i
next i
或简单的直接输出1683即可