VB.求出0~100的整数能够被3整除的个数以及能够被7整除的个数。程序代码怎么写?

2025-03-21 04:16:46
推荐回答(4个)
回答1:

private sub command1_click
dim sum as integer'和
dim count as integer'个数
sum=0
count=0
text3.text=""
For i=1 to 100
If i Mod 3=0 And i Mod 7<>0 Then
count=count+1
sum=sum+i
text3.text=text3.text & i'text3显示都有什么数
End If
Next
text1.text="和为:"+ sum
text2.text="个数为:"+coun
end sub

回答2:

Private Sub Command1_Click()
Print "0~100的整数能够被3整除的个数="; 100 \ 3 + 1
Print
Print "0~100的整数能够被7整除的个数="; 100 \ 7 + 1
End Sub

回答3:

就是能被21整除的个数

回答4:

这么简单