FANDOM


다음 결과그림처럼 입력한 수가 소수이면, ' 소수입니다.' 아니면, '소수가 아닙니다' 라는 msgbox가 뜨도록 프로그램을 만들어보세요..

Test2.jpg

코드 입력하기 Edit

Dim i As Integer, j As Integer Dim Prime As Boolean

For i = 2 To Text1.Text

  Prime = True
  
  
For j = 2 To i - 1
   If i Mod j = 0 Then
        MsgBox "소수입니다"
   Else
        MsgBox "소수가 아닙니다"
   Prime = False
        
   End If
   Next j

   
   If Prime Then
        Print i
        
   End If
   
   Next i

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on FANDOM

Random Wiki