Ejercicios de programación .net (nivel inicial)

Se muestra el funcionamiento de los conceptos básicos para programar en .net Se muestra el funcionamiento de los conceptos básicos para programar en .net

10.04.2019 Views

Vector n posiciones Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim n1, n2, n3 As Integer n1 = InputBox("Ingrese 1° Vector") Dim vec(n1) As Integer For i = 1 To n1 vec(i) = InputBox("Ingrese Valor " & i) ListBox1.Items.Add(vec(i)) Next n2 = InputBox("Ingrese redimensión") If n2 > n1 Then ReDim Preserve vec(n2) For i = n1 + 1 To n2 vec(i) = InputBox("Ingrese Valores redimension a partir de " & n1) Next For i = 1 To n2 ListBox2.Items.Add(vec(i)) Next Else MsgBox("ingrese numero mayor que vector 1") End End If End Sub End Class Leonel Navarrete

While – Do – Do While Public Class Form1 Dim x As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click x = 0 While x

Vector n posiciones<br />

Public Class Form1<br />

Private Sub Button1_Click(ByVal sen<strong>de</strong>r As System.Object, ByVal<br />

e As System.EventArgs) Handles Button1.Click<br />

Dim n1, n2, n3 As Integer<br />

n1 = InputBox("Ingrese 1° Vector")<br />

Dim vec(n1) As Integer<br />

For i = 1 To n1<br />

vec(i) = InputBox("Ingrese Valor " & i)<br />

ListBox1.Items.Add(vec(i))<br />

Next<br />

n2 = InputBox("Ingrese redimensión")<br />

If n2 > n1 Then<br />

ReDim Preserve vec(n2)<br />

For i = n1 + 1 To n2<br />

vec(i) = InputBox("Ingrese Valores redimension a<br />

partir <strong>de</strong> " & n1)<br />

Next<br />

For i = 1 To n2<br />

ListBox2.Items.Add(vec(i))<br />

Next<br />

Else<br />

MsgBox("ingrese numero mayor que vector 1")<br />

End<br />

End If<br />

End Sub<br />

End Class<br />

Leonel Navarrete

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!