Issuu on Google+

Realice el Formulario y encuentre los errores del siguiente programa que permite hallar los nĂşmero primos de un vector Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim N, i, j, x As Integer N = Val(TextBox1.Text) Dim vector(N) As Integer prim = 0 For i = 1 To N vector(i) = InputBox("vector " & i) For i = 1 To N prim = 0 x = vector For j = 1 To x If (x Mod 2 = 0) Then prim = prim + 1 End If

Next If prim = 2 Then

TextBox2.Text = TextBox2.Text & x & vbCrLf End If

Next

Next

For i = 1 To N TextBox3.Text = TextBox3.Text & vector(i) & vbCrLf Next i End Sub


Primos de un vector con errores