填空题
[说明]
本程序求3~100之间的所有素数(质数)并统计个数;同时将这些素数从小到大依次写入顺序文件 E:/dataout.txt;素数的个数显示在窗体Form1上。
[Visual Basic 代码]
Private Sub Command1 Click ( )
Dim count as integer, flag as Boolean
Dim t1 as Integer, t2 as Integer
{{U}} (1) {{/U}}
Count=0
For t1=3 to 100
{{U}} (2) {{/U}}
For t2=2 to Int (Sqr (t1))
If{{U}} (3) {{/U}}Then flag=False
Next t2
{{U}} (4) {{/U}}
count=count +1
write #1, t1
End if
Next t1
{{U}} (5) {{/U}}
Close #1
End Sub