FANDOM


수행평가 1차:
다음 입·출력 예시를 참고하여 입력창에 자연수를 입력받은 후, 입력받은 수까지 소수의 합계를 구하세요.

Test1


코드 입력 하기 편집

Private Sub Command1_Click()
Dim i As Integer, j As Integer
Dim prime As Boolean
Dim sum As Integer

sum = 0


For i = 2 To 100
prime = True
For j = 2 To i - 1
If i Mod j = 0 Then
prime = False
Exit For
End If
Next j

If prime Then
sum = sum + i

Label3.Caption = sum
End If
Next i



End Sub

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