求1+3+5+7+9+11+这样的奇数之和若累加数大于500时, 则结束累加
set talk off
clear
local n,i
n=0
for i=1 to 500 step 2
n=n+i
endfor
n
编程序求出100到800之间同时满足除4余1和除5余3条件的数的个数
set talk off
clear
local n
n=0
for i=100 to 800
if i%4=1andi%5=3
n=n+1
endif
endfor
n
编程序求出1000到2000之间同时满足除3余2和除5余3条件的数的个数。
set talk off
clear
local n
n=0
for i=1000 to 2000
if i%3=2andi%5=3
n=n+1
endif
endfor
n
编程序求出3000到5000之间同时满足除3余2和除5余3条件的数的个数。
set talk off
clear
local n
n=0
for i=3000 to 5000
if i%3=2andi%5=3
n=n+1
endif
endfor
n
求能被3整除且至少有一位数字为5的三位数的个数。
set talk off
clear
local a,b,c,n
n=0
FOR i=100 to 999
a=val(substr(ALLTRIM(str(i)),1,1))
b=val(substr(ALLTRIM(str(i)),2,1))
c=val(substr(ALLTRIM(str(i)),3,1))
if i%3=0and(a=5orb=5orc=5)
n=n+1
endif
ENDFOR
n
编写程序,求10!
set talk off
clear
local n
n=1
for i=1 to 10
n=in
endfor
n
编写程序,s=1+1/2+1/3+…+1/99,保留两位小数
SET TALK OFF
CLEAR
s=0
FOR i=1 TO 99
s=s+1/i
ENDFOR
ROUND(s,2)
求出只要能被2,7,9之一整除的1000以内的正整数的个数
set talk off
clear
n=0
for i=1 to 1000
if i%2=0ori%7=0ori%9=0
n=n+1
endif
endfor
n
求出只要能被2,7,9之一整除的800以内的正整数的个数
set talk off
clear
n=0
for i=1 to 800
if i%2=0ori%7=0ori%9=0
n=n+1
endif
endfor
n
求出只要能被2,7,9之一整除的600以内的正整数的个数
set talk off
clear
n=0
for i=1 to 600
if i%2=0ori%7=0ori%9=0
n=n+1
endif
endfor
n
编程序求出1到100之间同时满足除3余2和除4余2条件的数的和
set talk off
clear
n=0
for i=1 to 100
if i%3=2andi%4=2
n=n+i
endif
endfor
n
编程序求出1到500之间同时满足除3余2和除4余2条件的数的和
set talk off
clear
n=0
for i=1 to 500
if i%3=2andi%4=2
n=n+i
endif
endfor
n
求[105,625]间能同时被7和11整除的自然数之和
set talk off
clear
n=0
for i=105 to 625
if i%7=0andi%11=0
n=n+i
endif
endfor
n
求[1000,6000]间能同时被7和11整除的自然数之和
set talk off
clear
n=0
for i=1000 to 6000
if i%7=0andi%11=0
n=n+i
endif
endfor
n
编写程序,求200到800之间素数的个数
set talk off
CLEAR
LOCAL i,j,n
n=0
FOR i=200 to 800
FOR j=2 TO INT(SQRT(i))
IF i%j=0
EXIT for
ENDIF
ENDFOR
IF j>INT(SQRT(i))
n=n+1
ENDIF
ENDFOR
n
编写程序,求600到900之间素数的个数
set talk off
CLEAR
LOCAL i,j,n
n=0
FOR i=600 to 900
FOR j=2 TO INT(SQRT(i))
IF i%j=0
EXIT for
ENDIF
ENDFOR
IF j>INT(SQRT(i))
n=n+1
ENDIF
ENDFOR
n
编写程序,求600到900之间素数的和
set talk off
CLEAR
LOCAL i,j,n
n=0
FOR i=600 to 900
FOR j=2 TO INT(SQRT(i))
IF i%j=0
EXIT for
ENDIF
ENDFOR
IF j>INT(SQRT(i))
n=n+i
ENDIF
ENDFOR
n
编写程序,求200到800之间素数的和
set talk off
CLEAR
LOCAL i,j,n
n=0
FOR i=200 to 800
FOR j=2 TO INT(SQRT(i))
IF i%j=0
EXIT for
ENDIF
ENDFOR
IF j>INT(SQRT(i))
n=n+i
ENDIF
ENDFOR
n
计算S=3!+5!+7!++N!,求直到S>=680000为止的奇数N。
SET TALK OFF
CLEAR
LOCAL s,n
s=0
n=1
DO WHILE s<680000
n=n+2
s=s+nn(n)
enddo
n
FUNCTION nn
LPARAMETERS n
LOCAL t
t=1
FOR i=1 TO n
t=ti
ENDFOR
RETURN t
ENDFUNC
s=1!+2!+3!++n! 当s大于61000时结束累加,求n
SET TALK OFF
CLEAR
LOCAL s,n
s=0
n=0
DO WHILE s<=61000
n=n+1
s=s+nn(n)
enddo
n
FUNCTION nn
LPARAMETERS n
LOCAL t
t=1
FOR i=1 TO n
t=ti
ENDFOR
RETURN t
ENDFUNC
26、顺序执行以下赋值命令后,下列表达式中,合法的表达式是( D )
X=”12”
Y=23
Z=LEFT(“FOXPRO”,3)
A X+Y
B Y+Z
C X-Z=Y
D X-X+Z-Z
34、在数据库设计器中,如果两个表的索引标识之间有一条黑线相接,表示这两个表存在着( A )。
A 永久关系
B 临时关系
C 索引关系
D 触发关系
38、已知有学生表studentdbf,并已有按学号索引文件xhidx,在执行如下命令:
use student index xh
go top
skip-1
skip
此时记录指针向( C )。
A 记录号为1的记录
B 记录号为2的记录
C 前面第一条记录
D 前面第二条记录
39、已知有学生表studentdbf,并已按学号字段索引,其索引文件为xhidx,现执行命令:use student index xh 后,记录指针指向(C )
A 表的开始位置(即bof)
B 记录号为1的记录
C 学号最靠前的记录
D 不确定
46、在sql的select语句中,参数top n 用于限制查询记录的数目,与之匹配合使用的子句为( B )
A where 子句
B order by 子句
C group by 子句
D join 子句
程序1
clear
"1992-2020年中间的闰年有:"
for year=1992 to 2020
if year%4==0 and year%100!=0 or year%400==0
year
endif
endfor
程序2
clear
s=0
for i=100 to 999
if i%11=0
if i%10=8 or i/10%10=8 or i/100=8
i
s=s+1
endif
endif
endfor
"三位数中总共有",s,"个能被11整除同时又含有8的数字"
程序3
clear
a="Long long ago,there was a war between the birds and the beats No one knows what they fought aboutThe bat did not know whose side he should take He thought and thought, "
c="then decided he must try to be on the side of the winnersSo he watched from far away After a while, it seemed that the birds were going to winHe flew over to join them"
b=""
i=1
for j=1 to len(a)
if substr(a,j,1)!=" "
b=b+substr(a,j,1)
endif
endfor
for j=1 to len(c)
if substr(c,j,1)!=" "
b=b+substr(c,j,1)
endif
endfor
b
程序4
input "请输入数字:" to n
P=2N-1
FOR I=1 TO P
IF I<=N
SPACE(N-I+1)
FOR J=1 TO 2I-1
""
ENDFOR
ELSE
SPACE(I-N+1)
FOR K=1 TO 2(2N-I)-1
""
ENDFOR
ENDIF
ENDFOR
以上就是关于VFP程序的题目,帮帮忙啦全部的内容,包括:VFP程序的题目,帮帮忙啦、关于VFP的两道程序设计题,不会了,求解~、VFP编程题求解等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)