已知S1=1,S2=1+2,S3=1+2+3,…SN=1+2+3+…+N,求S1,S2,S3,…S2200中有多少个能被3或7整除的数.

问题描述:

已知S1=1,S2=1+2,S3=1+2+3,…SN=1+2+3+…+N,求S1,S2,S3,…S2200中有多少个能被3或7整除的数.
编程题!
有一处错误请修改一下 给出结果吧!
SET TALK OFF
CLEA
I=1
N=0
DO WHILE I

Private Sub Command1_Click()
For i = 1 To 2200
a = a + 1
s = s + a
If s Mod 3 = 0 Then B1 = B1 + 1
If s Mod 7 = 0 Then B2 = B2 + 1
Next
Print "被3整除的有"; B1; "个"
Print "被7整除的有"; B2; "个"
End Sub
不好意思,只学VB,在网吧弄的~
答案是:B1=1466 B2=628