作业帮 > 综合 > 作业

VB编程求1——500之中能被3整除但不能被5整除的数的个数以及这些数累加的和.

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/15 08:41:25
VB编程求1——500之中能被3整除但不能被5整除的数的个数以及这些数累加的和.
RT
count = 0
sum = 0
for i=1 to 500
if i%3=0 and i%50 then
count = count + 1
sum = sum + i
next i
再问: 请问这个可以用do while ......做么?可以的话怎么做。。
再答: count = 0 sum = 0 i = 1 do if i%3=0 and i%50 then count = count + 1 sum = sum + i i = i + 1 loop while i