Ejercicios de Visual Basic 3
Realizar un programa para obtener mayor de tres numeros
1. Insertamos los objetos con sus respectivos nombres
OBJETO
|
NOMBRE
|
CAPTION
|
|
Form
|
frmPrincipal
|
AREA DEL CIRCULO
|
|
Label
|
lblNum1
|
NUMERO 1
|
|
Label
|
lblNum2
|
NUMERO 2
|
|
Label
|
lblNum3
|
NUMERO 3
|
|
Label
|
lblMayor
|
MAYOR
|
|
TextBox
|
txtNum1
|
||
TextBox
|
txtNum2
|
||
TextBox
|
txtNum3
|
||
TextBox
|
txtMayor
|
||
CommandButton
|
btnVerificar
|
VERIFICAR
|
|
CommandButton
|
btnSalir
|
SALIR
|
EN EL PROGRAMA DEBE VISUALIZARSE ASI:
2. Colocamos el siguiente codigo
Option Explicit
Private Sub btnSalir_Click()
End
End Sub
Private Sub btnVerificar_Click()
Dim a, b, c, mayor As Integer
a = InputBox("ingrese Numero 1", "dato del usuario")
b = InputBox("ingrese Numero 2", "dato del usuario")
c = InputBox("ingrese Numero 3", "dato del usuario")
txtnum1.Text = a
txtnum2.Text = b
txtnum3.Text = c
If a > b And a > c Then
mayor = a
Else
If b > a And b > c Then
mayor = b
Else
mayor = c
End If
End If
txtmayor.Text = mayor
End Sub
EN EL PROGRAMA VISUALIZAMOS ASI
UNA VEZ TERMINADO PONEMOS EJECUTAR
Y de este modo hemos terminado con este ejercicio
No hay comentarios:
Publicar un comentario