2013년 3월 2일 토요일
Code VBA: Kiểm tra một số nguyên (>2) có phải là số nguyên tố hay không
Posted By:
Unknown
on 오후 6:32
Bài toán: Kiểm tra một số nguyên (>2) có phải là nguyên tố hay không ?
Dim so As Integer
Dim uoc As Integer
Dim nguyento As Boolean
nguyento = True
For uoc = 2 To Int(so / 2)
If so Mod uoc = 0 Then
nguyento = False
Exit For
End If
Next
If nguyento Then
Msgbox "là số nguyên tố"
Else
Msgbox "không là số nguyên tố !"
End If
피드 구독하기:
댓글 (Atom)
0 개의 댓글:
댓글 쓰기