VFP简单程序设计题
发布网友
发布时间:2022-05-20 22:10
我来回答
共1个回答
热心网友
时间:2023-10-05 03:49
clear
1.
set talk off
n=0
s=0
for i=1 to 1000
if i%3=0 and i%7=0
n=n+1
s=s+i
endif
endfor
?"1-1000能同时被3和7整除的数有"+allt(str(n))+"个"
?"它们的和是:"+allt(str(s))
set talk on
2.
set talk off
for a=1 to 9
for b=0 to 9
for c=0 to 9
if 100*a+10*b+c=a*a*a+b*b*b+c*c*c
? 100*a+10*b+c
endif
next c
next b
next a
return
set talk on
3.
clear
set talk off
input "请输入年份:"to n
msg="年不是闰年"
if mod(n,4)=0 and mod(n,100)<>0 or mod(n,400)=0
msg="年是闰年"
endif
?n,msg
set talk on