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

Día del Año, con BISIESTO Public Class Form2 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim año, mes, dia, a, bisiesto As Integer año = Mid(TextBox1.Text, 1, 4) mes = Mid(TextBox1.Text, 6, 2) a = Mid(TextBox1.Text, 9, 2) bisiesto = año Mod 4 If año < 1900 Or año > 2014 Then MsgBox("INGRESE OTRO AÑO") Else If mes 12 Then MsgBox("INGRESE OTRO MES") Else Select Case mes Case 1, 3, 5, 7, 8, 10, 12 dia = 31 Case 4, 6, 9, 11 dia = 30 Case 2 If bisiesto = 0 Then dia = 29 Else dia = 28 End If End Select If a > dia Then MsgBox("Ingrese otro dia") Else MsgBox("Fecha valida") End If End If End If End Sub End Class Leonel Navarrete

Bucle For Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim resp As Integer Dim I As Integer Dim R As Integer R = Val(TextBox1.Text) For I = 1 To 10 Step 1 resp = I * R ListBox1.Items.Add(I & " * " & R & " = " & resp) Next End Sub End Class Leonel Navarrete

Bucle For<br />

Public Class Form1<br />

Private Sub Button1_Click(ByVal sen<strong>de</strong>r As<br />

System.Object, ByVal e As System.EventArgs) Handles<br />

Button1.Click<br />

Dim resp As Integer<br />

Dim I As Integer<br />

Dim R As Integer<br />

R = Val(TextBox1.Text)<br />

For I = 1 To 10 Step 1<br />

resp = I * R<br />

ListBox1.Items.Add(I & " * " & R & " = "<br />

& resp)<br />

Next<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!