You are on page 1of 5

If x > 21 Then

x = 1
End If
Select Case x
Case 1
txtverde.BackColor = Color.Green
txtred.BackColor = Color.Red
red.BackColor = Color.Red
rojo.BackColor = Color.Red
Case 2
txtamarillo.BackColor = Color.Yellow
Case 3
txtverde.BackColor = Color.White
Case 4
txtrojo.BackColor = Color.Red
txtyellow.BackColor = Color.Yellow
txtamarillo.BackColor = Color.White
Case 5
txtred.BackColor = Color.White
Case 6
txtgreen.BackColor = Color.Green
txtyellow.BackColor = Color.White
Case 7
txtyellow.BackColor = Color.Yellow
Case 8
txtgreen.BackColor = Color.White
Case 9
txtred.BackColor = Color.Red
txtyellow.BackColor = Color.White
amarillo.BackColor = Color.Yellow
Case 10
rojo.BackColor = Color.White
Case 11
verde.BackColor = Color.Green
amarillo.BackColor = Color.White
Case 12
amarillo.BackColor = Color.Yellow
Case 13
verde.BackColor = Color.White
Case 14
rojo.BackColor = Color.Red
amarillo.BackColor = Color.White
yellow.BackColor = Color.Yellow
Case 15
red.BackColor = Color.White
Case 16
green.BackColor = Color.Green
yellow.BackColor = Color.White
Case 17
yellow.BackColor = Color.Yellow
Case 18
green.BackColor = Color.White
Case 19
red.BackColor = Color.Red
yellow.BackColor = Color.White
txtamarillo.BackColor = Color.Yellow
Case 20
txtrojo.BackColor = Color.White
Case 21
txtverde.BackColor = Color.Green
txtamarillo.BackColor = Color.White
End Select

declaracion de variables
Dim variablea As Integer
Dim variableb As Integer
Dim variablec As Integer
Dim nmenor As Integer
Dim nmayor As Integer
'proceso
variablea = InputBox("ingrese valor 1 ")
variableb = InputBox("ingrese valor 2 ")
variablec = InputBox("ingrese valor 3 ")

If variablea < variableb And variablea < variablec Then


nmenor = variablea
ElseIf variableb < variablea And variableb < variablec Then
nmenor = variableb
ElseIf variablec < variablea And variablec < variableb Then
nmenor = variablec
End If
If variablea > variableb And variablea > variablec Then
nmayor = variablea
ElseIf variableb > variablea And variableb > variablec Then
nmayor = variableb
ElseIf variablec > variablea And variablec > variableb Then
nmayor = variablec
End If
If variablea = variableb Then
MsgBox("no se permite valores iguales")
End If
If variablea = variablec Then
MsgBox("no se permite valores iguales")
End If
If variableb = variablec Then
MsgBox("no se permite valores iguales")
End If
'salida de la informacion
txtva.Text = variablea
txtvb.Text = variableb
txtvc.Text = variablec
txtnmenor.Text = nmenor
txtnmayor.Text = nmayor
End Sub
Private Sub btnnuevo_Click(sender As Object, e As EventArgs) Handles btnnuevo.Click
txtva.Clear()
txtvb.Clear()
txtvc.Clear()
txtnmenor.Clear()
txtnmayor.Clear()
End Sub
Private Sub btncerrar_Click(sender As Object, e As EventArgs) Handles btncerrar.Click
End
End Sub
Private Sub btncalcular_Click(sender As Object, e As EventArgs) Handles
btncalcular.Click
'declaracio de variables
Dim ndias As Double
Dim años As Double
Dim meses As Double
Dim semanas As Double
Dim dias As Double
'entrada de datos
ndias = Val(txtndias.Text)
'proceso
Do While ndias >= 365
años = 1
ndias = ndias - 365
Do While ndias >= 365
años = años + 1
ndias = ndias - 365
Loop
Loop
Do While ndias >= 30
meses = meses + 1
ndias = ndias - 30
Do While ndias >= 30
meses = meses + 1
ndias = ndias - 30
Loop
Loop
Do While ndias >= 7
semanas = semanas + 1
ndias = ndias - 7
Do While ndias >= 7
semanas = semanas + 1
ndias = ndias - 7
Loop
Loop
dias = ndias

'salida de la informacion
txtaños.Text = años
txtmeses.Text = meses
txtsemanas.Text = semanas
txtdias.Text = dias
End Sub
Private Sub btnnuevo1_Click(sender As Object, e As EventArgs) Handles btnnuevo1.Click
txtndias.Clear()
txtaños.Clear()
txtmeses.Clear()
txtsemanas.Clear()
txtdias.Clear()
End Sub

Private Sub btncerrar1_Click(sender As Object, e As EventArgs) Handles


btncerrar1.Click
End
End Sub

Private Sub btncalcular1_Click(sender As Object, e As EventArgs) Handles


btncalcular1.Click
'declaracio de variables
Dim cincuenta As Integer
Dim veinte As Integer
Dim diez As Integer
Dim cinco As Integer
Dim uno As Integer
Dim resto As Integer
Dim valor As Integer

'entrada de datos
valor = Val(txtvalor.Text)
'proceso
Do While valor >= 50000
cincuenta = 1
valor = valor - 50000
Do While valor >= 50000
cincuenta = cincuenta + 1
valor = valor - 50000

Loop
Loop
Do While valor >= 20000
veinte = veinte + 1
valor = valor - 20000
Do While valor >= 20000
veinte = veinte + 1
valor = valor - 20000
Loop
Loop
Do While valor >= 10000
diez = diez + 1
valor = valor - 10000
Do While valor >= 10000
diez = diez + 1
valor = valor - 10000
Loop
Loop
Do While valor >= 5000
cinco = cinco + 1
valor = valor - 5000
Do While valor >= 5000
cinco = cinco + 1
valor = valor - 5000
Loop
Loop
Do While valor >= 1000
uno = uno + 1
valor = valor - 1000
Do While valor >= 1000
uno = uno + 1
valor = valor - 1000
Loop
Loop
resto = valor
'salida de la informacion
txt50.Text = cincuenta
txt20.Text = veinte
txt10.Text = diez
txt5.Text = cinco
txt1.Text = uno
txtr.Text = resto
End Sub

Private Sub btnnuevo2_Click(sender As Object, e As EventArgs) Handles btnnuevo2.Click


txtvalor.Clear()
txt50.Clear()
txt20.Clear()
txt10.Clear()
txt5.Clear()
txt1.Clear()
txtr.Clear()

You might also like