December 31, 2017

# Write a VB program to find the prime numbers between 1 to100 and display it onto the form.

Write a Visual Basic program to find the prime numbers between 1 to100 and display it onto the form.

Private Sub cmdPrime_Click() Dim p, n, i As Integer p = 1 Print “Prime Numbers are : “ For n = 1 To 100 For i = 2 To n – 1 If n Mod i = 0 Then p = 0 Exit For Else p = 1 End If Next If p = 1 Then Print n End If Next End Sub

4 Comments

nice

nice

nice

nice