- 120
- 0
- 约4.16千字
- 约 4页
- 2017-05-12 发布于河南
- 举报
vb程序设计for循环练习
1.终止FOT/NEXT循环的条件是:________
2.决定FOR/NEXT循环次数的因素是循环变量的________,_______,和步长。
3.FOR/NEXT循环的步长为____时可以省略。
4.FOR I=A TO B STEP C,循环次数的表达式为 ________.
5.写出下面程序的结果。
(1) For i=-5 to -11 step -3
S=s+i
Print s
Next
(2) A$=”ls”
For x=5 to 3 step -1
A$=a$+a$
Next x
Print mid$(a$,x,3)
(3) for i=9 to 2 step -6
i=i+2
print i*2;
next i
print i*2;
(4) for i=1 to 10
if i\2=i/2 then 40
s=s+i
40 next
print s
(5) p=1
for a=10 to 2 step -2
p=p*a
next a
?a,p
(6) s$=””
for i=65 to 70 step 2
s$=s$+chr$(i)
next
print s$
(7) c$=”1234”
for i=1 to len(c$)
n=n+val(mid$(c$,i))
next
print n
(8) for x=0 to 100 step 2
print x
next x
程序循环了________次。
(9) for x=-3 to 7 step 2
print x;
next
(10) for x=8 to 7 step -2
print x;
next x
(11) for x=2 to 7 step 2
x=x+2
print x;
next x
(12) for x=-2 to -7 step -2
x=-x^2
print x;
next x
(13) for x=1.5 to 11 step 1.5
print x;
next x
(14) for x%=1.5 to 15 step 1.5
print x%;
next x%
(15) for i=1 to 10
print I;
i=i+1
next i
(16) for i=1 to 10
print I;
i=i*2
next i
(17) for a=1 to 5
b=a*a+1
print a,b
c=a*a
next a
print “b=”;b,”c=”;c
(18) for i=-5 to 5
if i0 then x=x+i
if i0 then y=y+i
next i
print “x=”;x
print “y=”;y
(19) s=0:m=1
for k=1 to 100
s=s+m*k:m=-m
next k
print s
(20) for i=2 to 1 step -1
print i
next i
print i
(21) s=0
for i=1 to 5
y=rnd(1)+1
s=s+int(y)
next
print s
(22) k=1:s=0
for i=1 to 5
s=s+k*i
k=-k
next i
print s
(23) for i=10 to 6 step -1
J=i
Next i
Print j;i
(24) p=1
For a=10 to 2 step -2
P=p*a
Next a
Print a,p
(25) x=1
For i=1 to 3
If k=1 then a=x*x
If k=2 then a=x*x+1
If k=3 then a=x*x+2
Print a;
Next i
(26) s=0
For i=1 to 3
If i=1 then
P=1
Elseif i=2 then
P=2
Elseif i=3 then
P=3
Else
P=4
End if
Print p
s=s+p
next i
print s
(27) for j=5 to 8
A=a*10+j
Next j
Print a
(28) aa$=”43.2”:bb$=”98.7”
Cc$=aa$+bb$
Dd=val(cc$)
Print dd
(29) bb$=”Inviting a friend to dinner”
M=len(bb$)
For j=1 to m
B$=mid$(bb$,j,1)
If b$=”n” then x=x+1
Next j
Prin
您可能关注的文档
- LabVIEW实验1.doc
- LINQ TO SQL技术小结.doc
- KVDBGrid控件使用方法.doc
- LED屏软件安装及使用说明.doc
- LECTURE 2 C程序设计2.doc
- linux实验三.doc
- linux学习笔记-tar-目录-命令.doc
- Linux实验练习5.doc
- Loop控制变量名.doc
- lymOS课程设计任务书12网.doc
- 2025-2026学年天津市和平区高三(上)期末数学试卷(含解析).pdf
- 2025-2026学年云南省楚雄州高三(上)期末数学试卷(含答案).pdf
- 2025-2026学年甘肃省天水市张家川实验中学高三(上)期末数学试卷(含答案).docx
- 2025-2026学年福建省厦门市松柏中学高二(上)期末数学试卷(含答案).docx
- 2025-2026学年广西钦州市高一(上)期末物理试卷(含答案).docx
- 2025-2026学年河北省邯郸市临漳县九年级(上)期末化学试卷(含答案).docx
- 2025-2026学年河北省石家庄二十三中七年级(上)期末历史试卷(含答案).docx
- 2025-2026学年海南省五指山市九年级(上)期末化学试卷(含答案).docx
- 2025-2026学年河北省唐山市玉田县九年级(上)期末化学试卷(含答案).docx
- 2025-2026学年河北省邢台市市区九年级(上)期末化学试卷(含答案).docx
最近下载
- 2022届上海市徐汇区高三上学期12月一模英语试卷-Word版含答案.doc VIP
- (完整版)Aitken拖延问卷(API).docx VIP
- MTU软件简易操作培训课件32.pdf VIP
- 2026年春统编版九年级下册语文教学计划及教学进度表.docx VIP
- 学校“最小应急单元”突发事件处置工作指引解读课件.pptx VIP
- 深圳大学《现代通信原理》2021-2022学年第一学期期末试卷.doc VIP
- 人教版八年级数学下册教学工作计划与教学进度表(2026春季学期).docx
- 07CJ03-1:轻钢龙骨石膏板隔墙、吊顶(参考图集).pdf VIP
- 赤壁赋教学实录与课堂案例分析.docx VIP
- 化工工艺培训PPT课件.pptx VIP
原创力文档

文档评论(0)