试题 试卷
题型:单选题 题类:常考题 难易度:普通
浙教版初中信息技术九年级上学期期末试卷(5)
Dim Y As Integer
Y=0
Do While Y<30
Y=(Y+2)*(Y+3)
Loop
Private Sub Form_Click()
n=1
s=0
Do while {#blank#}1{#/blank#}
s={#blank#}2{#/blank#}
n=n+1
Print s
End sub
Private Sub Form-Click()
Dim S As Integer
Dim N As Integer
N=0
S=0 ‘S变量存放的是总和
Do While {#blank#}1{#/blank#} (条件)
N=N+1
S=S+N
Text1. Text=Str({#blank#}2{#/blank#})
End Sub
For {#blank#}1{#/blank#} to 9
For b=0 to 9
For c=0 to 9
For d=0 to 9
X={#blank#}2{#/blank#}
If {#blank#}3{#/blank#} then
print x
End if
Next d
Next c
Next b
Next a
百千白鸡问题是经典的数学问题,原题为“鸡翁一,值钱五;鸡母一,值钱三;鸡雏三,值钱一;百钱买百鸡,则翁、母、雏各几何?”翻译过来,意思是公鸡一个五块钱,母鸡一个三块钱,小鸡三个一块钱,现在要用一百块钱买一百只鸡,问公鸡、母鸡、小鸡各多少只?
import random
while True:
x=random.randrange(0,20)
y=random.randrange(0,33)
z=random.randrange(0,100)
if 5*x+3*y+z/3==100 and x+y+z==100:
print('公鸡',x)
print('母鸡',y)
print('小鸡',z)
for i in range (1,5):
s=s+i
print("i=",i,"s=",s)
要求:请在指定的代码区内写出程序代码,完成题目要求的功能。
程序代码:
#!/usr/bin/python3
#变量i表示循环变量,p表示积
试题篮