vf命令计算出1-50以内能被3和5整除的数之和
问题描述:
vf命令计算出1-50以内能被3和5整除的数之和
求大神指导这个程序哪里出错了?
clear
set talk off
x=0
y=1
do while not eof()
x=x+1
do case
case mod(x,5)=0 or mod(x,3)=0
y=y+x
case x50
exit
endcase
enddo
?y
答
clearset talk offx=0y=0 &&原来y=1do while not eof()x=x+1do casecase mod(x,5)=0 and mod(x,3)=0 &&原来case mod(x,5)=0 or mod(x,3)=0y=y+xcase x50exitendcaseenddo