追蹤
ˊ-橙色九月-ˊ
關於部落格
  • 33917

    累積人氣

  • 9

    今日人氣

    0

    追蹤人氣

VB11

/*********************************
/*11900-940303 Program Start
/*********************************
Dim i as Integer
Dim n as Integer
Dim  as String
open "A:940303.sm" For Input As #1
Input #1, n
Close #1
第一種方法
For i = 2 to n-1
If (n mod i)=0 then
s=n & "is not a prime number"
Exit For
End If
s = n & "is a prime number"
Next
第二種方法
i = 2
Do while i <= n-1
If (n mod i)=0 then
s = n & "is not pnime"
Exit Do
End If
s = n & "is a pnime number"
i = i + 1
Loop
第三種方法
i = 2
Do
If (n mod i)=0 then
s = n & "is not a prime"
Exit Do
End if
s = n & "is a prime number"
i = i + 1
Loop while I <= n-1

Text1.text="第三題結果:" & vbCrLf & vbCrLf & s
相簿設定
標籤設定
相簿狀態