You are on page 1of 18

20.- Realizar un Programa que permita sumar dos nmeros naturales.

Private Sub cmdSumar_Click()


Dim a As Integer
Dim b As Integer
Dim suma As Integer
a = InputBox("Ingrese nmero 1")
b = InputBox("Ingrese nmero 2")
suma = a + b
TxtSuma.Text = "La suma es:" & suma
End Sub
21.- Realizar un programa que permita restar dos nmeros naturales.
Private Sub cmdRestar_Click()
Dim res As Integer
Dim A As Integer
Dim B As Integer
A = txt1.Text
B = txt2.Text
res = (A - B)
MsgBox ("Resta Igual a:" & res)
End Sub
22.- Realizar un programa que permita multiplicar dos nmeros
naturales.
Private Sub cmdMult_Click()
Dim A As Integer
Dim B As Integer
Dim mult As Integer
A = txt1.Text
B = txt2.Text
mult = A * B
MsgBox ("La Multiplicacin es:" & mult)
End Sub
23.- Realizar un programa que permita dividir dos nmeros naturales.
Private Sub cmdDividir_Click()
Dim A As Integer
Dim B As Integer
Dim div As Double
A = txt1.Text
B = txt2.Text
div = A / B
MsgBox ("La divisin es:" & div)
End Sub

24.- Realizar un Algoritmo que imprima cuantos Bs son un valor x de


dlares ingresados por el usuario. La tasa de cambio es de 6.96 Bs por
cada dlar.
Private Sub cmdCambio_Click()
Dim dolares As Double
Dim bolivianos As Double
dolares = InputBox("Ingrese dlaras")
bolivianos = dolares * 6.96
TxtResultado.Text = "Son:" & bolivianos
End Sub
25.- Leer un nmero y si este es mayor a 0 , Imprimir el nmero.
Private Sub cmdNatural_Click()
Dim numero As Integer
txtSalida.Text = ""
numero = InputBox("Ingrese un nmero")
If numero > 0 Then
txtSalida.Text = "Es nmero natural"
Else
txtSalida.Text = "No es nmero natural"
End If
End Sub
26.- Pedir la nota de un estudiante y mostrar aprobado o reprobado,
segn la note sea mayor o igual a 51 que es de aprobacin.
Private Sub cmdAprob_Click()
Dim nota As Integer
nota = txtEntrada.Text
If nota >= 51 Then
MsgBox ("Aprobado")
Else
MsgBox ("Reprobado")
End If
End Sub

27.- Escribir un programa que pida la nota de un examen (un nro. real
entre 0 y 100) e imprima por pantalla la calificacin en formato

Reprueba, si la nota es menor que 51, Aprobado si la nota est entre


51 y 70 sin incluirlo, Notable si est entre 70 y 90 sin incluirlo,
Sobresaliente si est entre 90 y 100 sin incluirlo y Excelente si la
nota es igual a 100.
Private Sub cmdVerificar_Click()
Dim nota As Double
nota = TxtEntrada.Text
If nota < 51 Then
lblSalida.Caption = "Reprobado"
Else
If nota >= 51 And nota < 70 Then
lblSalida.Caption = "Aprobado"
Else
If nota >= 70 And nota < 90 Then
lblSalida.Caption = "Notable"
Else
If nota >= 90 And nota < 100 Then
lblSalida.Caption = "Sobresaliente"
Else
lblSalida.Caption = "Excelente"
End If
End If
End If
End If
End Sub

28.- Realizar un programa que permita leer dos nmeros y verifique si


son Amigos.

Private Sub cmdVerificar_Click()


Dim a As Integer
Dim b As Integer
Dim sma As Integer
Dim smb As Integer
a = InputBox("Ingrese A")
b = InputBox("Ingrese B")
sma = 0
For i = 1 To a - 1 Step 1
If (a Mod i = 0) Then
sma = sma + i
End If
Next i
smb = 0
For i = 1 To b - 1 Step 1
If (b Mod i = 0) Then
smb = smb + i
End If
Next i
If (sma = b And smb = a) Then
MsgBox ("Son Amigos")
Else
MsgBox ("NO Son Amigos")
End If
End Sub
29.- Calcular la distancia recorrida de un automvil conociendo los datos
del tiempo y la aceleracin.
Private Sub cmdCalcular_Click()
Dim t As Double
Dim a As Double
Dim d As Double
t = InputBox("Ingrese Valor de Tiempo")
a = InputBox("Ingrese Valor de Aceleracin")
d = (a / 2) * (t ^ 2)
txtSalida = ("La Distancia es:" & d)
End Sub

30.- Disear un programa que permita leer el nombre de un estudiante y


sus notas respectivas.
Private Sub cmdVer_Click()
Dim nombre As String
Dim PP As Integer
Dim SP As Integer
Dim F As Integer
nombre = InputBox("Nombre Estudiante")
PP = InputBox("Nota Primer Parcial")
SP = InputBox("Nota Segundo Parcial")
F = (PP + SP) / 2
lblSalida.Caption = (" El Nombre del Estudiante y su Nota Final es:" &
nombre & F)
End Sub
31.- Crear un programa que permita leer un nmero y verifique si es
par o impar.
Private Sub cmdVerificar_Click()
Dim n As Integer
n = txtEntrada.Text
If n > 0 Then
If (n Mod 2 = 0) Then
MsgBox (n & "es par")
Else
MsgBox (n & "es impar")
End If
Else
MsgBox ("Ingrese nmero Positivo")
End If
End Sub
32.- Disear un programa que calcule el rea sombreada de la figura,
conociendo como dato de entrada el radio de la circunferencia.
Private Sub cmdCalcular_Click()
Dim r As Double
Dim Acd As Double
Dim Acf As Double
Dim Area As Double
r = txtEntrada.Text
Acd = (2 * r) * (2 * r)
Acf = 3.1416 * r * r
Area = Acd - Acf
MsgBox ("Area:" & Area)
End Sub

33.- Disear un programa que muestre las races de una ecuacin


cuadrtica de la forma:

Private Sub cmdCalcular_Click()


Dim A As Double
Dim B As Double
Dim C As Double
Dim x1 As Double
Dim x2 As Double
A = txtA.Text
B = txtB.Text
C = txtC.Text
x1 = ((-B + Sqr(B ^ 2 - (4 * A * C))) / (2 * A))
x2 = ((-B - Sqr(B ^ 2 - (4 * A * C))) / (2 * A))
lblX1.Caption = "x1:" & x1
lblX2.Caption = "x2:" & x2
End Sub
34.- Disear un programa que muestre las races de una ecuacin
cuadrtica de la forma:
, pero verificando que la discriminante sea mayor que 0.

Private Sub CMDCALCULAR_Click()


Dim A As Double
Dim B As Double
Dim C As Double
Dim X1 As Double
Dim X2 As Double
Dim DISC As Double
A = TXTA.Text
B = TXTB.Text
C = TXTC.Text
DISC = (B * B - 4 * A * C)
If (DISC >= 0) Then
X1 = (-B - Sqr(B * B - 4 * A * C)) / (2 * A)
X2 = (-B + Sqr(B * B - 4 * A * C)) / (2 * A)
Else
MsgBox ("LA DISCRIMINANTE TIENE QUE SER MAYOR QUE 0")
End If
LBL1.Caption = ("X1=" & X1)
LBL2.Caption = ("X2=" & X2)
End Sub

35.- Disear un programa que permita leer un nmero entero positivo si


es primo encontrar el siguiente primo.
Private Sub cmdejecutar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdejecutar.Click
Dim n As Integer
Dim n2 As Integer
Dim c As Integer
Dim x As Double
Dim c2 As Integer
Dim x2 As Double
c2 = 1
n = InputBox("ingrese numero")
c=1
While c <= n
x = n Mod c
If x = 0 Then
c=c+1
End If
End While
If c = 3 Then
MsgBox("el numero es primo")
While c2 < n2
n2 = n
While c2 <= n2
x2 = n2 Mod c2
If x2 = 0 Then
c2 = c2 + 1
End If
End While
If c2 = 3 Then
MsgBox("el siguiente primo es" & n2)
c2 = n2
End If
n2 = n2 + 1
End While
End If
End Sub

36.- Disenar un programa que multiplique dos nmeros enteros sin usar
operadores.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles cmdejecutar.Click
Dim n1 As Integer
Dim n2 As Integer
Dim resultado As Double
Dim c As Double
n1 = InputBox("ingrese el primer numero")
n2 = InputBox("ingrese el segundo numero")
c=1
resultado = 0
If n2 > 0 Then
While c <= n2
resultado = resultado + n1
c=c+1
End While
MsgBox("el resultado es" & resultado)
Else
If n1 > 0 Then
While c <= n1
resultado = resultado + n2
c=c+1
End While
MsgBox("el resultado es" & resultado)
Else
c = -1
While c >= n1
resultado = resultado + n2
c=c-1
End While
resultado = resultado * (-1)
MsgBox("el resultado es" & resultado)
End If
End If
End Sub

37.- Disear un programa que genere los n primeros nmeros de la serie


fibonacci y luego muestre la suma de dichosnueros

Private Sub cmdfibonacciprimo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles cmdfibonacciprimo.Click
Dim
Dim
Dim
Dim
Dim
Dim
Dim

n As Integer
pri As Integer
seg As Integer
c As Integer
c2 As Integer
div As Integer
c3 As Integer

n=0
pri = 0
seg = 1
c=1
While c < 11
c2 = 1
c3 = 0
While c2 <= n
div = n Mod c2
If div = 0 Then
c3 = c3 + 1
End If
c2 = c2 + 1
End While
If c3 = 2 Then
MsgBox(n)
c=c+1
End If
pri = seg
seg = n
n = pri + seg
End While
End Sub
38.- Disear un programa que convierta un monto x de pesos a
bolivianos.
Private Sub Command1_Click()
Dim d, peso, conversion As Single
d = dolar.Text
peso = pesos.Text
conversion = Val(peso) / Val(d)
respuesta.Caption = "La cantidad de pesos insertada equivale a " &
conversion & " Dlares"
End Sub
39.- Escribir un programa que lea 5 nmeros enteros y escriba la media
aritmtica (Promedio) de los mismos.

Private Sub Command1_Click()


Dim
Dim
Dim
Dim
Dim

PrimerValor As Integer
SegundoValor As Integer
TercerValor As Integer
CuartoValor As Integer
QuintoValor As Integer

PrimerValor = Text1
SegundoValor = Text2
TercerValor = Text3
CuartoValor = Text4
QuintoValor = Text5
Label7 = (PrimerValor + SegundoValor + TercerValor + CuartoValor +
QuintoValor) /5
End Sub
40.- Escribir un programa que solicite al usuario la introduccin de un
nmero de tres dgitos y que lo imprima en orden inverso. Ejemplo: Para
una entrada de 695,la salida deber ser 596.
Private Sub Command1_Click()
Dim Numero As Integer
Dim CalculoUno As Integer
DimRespuestaUno As Integer
Dim CalculoDos As Integer
Dim RespuestaDos As Integer
Numero = Text1
CalculoUno = Numero \ 100
RespuestaUno = Numero Mod 100
CalculoDos = RespuestaUno \ 10
RespuestaDos = RespuestaUno Mod 10
Text2 = RespuestaDos & CalculoDos & CalculoUno
End Sub

41-. Dados tres valores enteros, los cuales representan las longitudes de
los lados de un tringulo, escribir un programa que determine si el
tringulo es issceles, equiltero o escaleno.

Private Sub Command1_Click()


Dim LadoUno As Integer, LadoDos As Integer, LadoTres As Integer
LadoUno = Text1
LadoDos = Text2
LadoTres = Text3
If LadoUno = LadoDos And LadoDos = LadoTres Then
Label4 = "Es equiltero"
Else
If LadoUno = LadoDos Or LadoUno = LadoTres Or LadoDos = LadoTres
OrLadoDos =
LadoUno Or LadoTres = LadoUno Or LadoTres = LadoDos
Then
Label4 = "Isosceles"
Else
Label4 = "Escaleno"
End If
End If
End Sub
42.- Disear un programa que permita leer un nmero y separar las
unidades, decenas y centenas.
Private Sub Command1_Click()
Dim N As Double
Dim U As Integer
Dim D As Double
Dim C As Double
N = Text2.Text
U = N Mod 10
D = N \ 10 Mod 10
C = N \ 100
MsgBox ("TUS UNIDADES SON:" & U)
MsgBox ("TUS DECENAS SON:" & D)
MsgBox ("TUS CENTENAS SON:" & C)
End Sub
43.- Disear un programa que permita sumar dos nmeros, nicamente
positivos.
Private Sub Command1_Click()
Dim A As Integer
Dim B As Integer
Dim C As Integer
A = num1.Text
B = num2.Text
C=A+B
If (A > 0) And (B > 0) Then
num3.Text = C
Else
MsgBox ("ponga un mumero mayor a 0")
End If
End Sub

44.- Disear un programa que permita leer un nmero e indicar si es


perfecto o no.
Private Sub perfecto _Click()
Dim NUM As Integer
Dim SUM As Integer
Dim i As Integer
NUM = Val(Text1.Text)
SUM = 0
For i = 1 To NUM - 1 Step 1
If (NUM Mod i = 0) Then
SUM = SUM + i
Text2.Text = SUM
End If
Next i
If (SUM = NUM) Then
MsgBox ("EL NUMERO ES PERFECTO")
Else
MsgBox ("EL NUMERO NO ES PERFECTO")
End If
End Sub
45.- Disear un programa que permita realizar una divisin entera.
Private Sub cmddividir_Click()
Dim a As Integer
Dim b As Integer
Dim div As Integer
a = Txta.Text
b = txtb.Text
div=(a\b)
MsgBox (El Resultado es: & div)
End Sub
46.- Disear un programa que permita mostrar el residuo de una
divisin.
Private Sub cmdresiduo_Click()
Dim a As Integer
Dim b As Integer
Dim res As Integer
a = Txta.Text
b = txtb.Text
res=(aModb)
MsgBox (El residuo es: & res)
End Sub

47.- Disear un programa que permita leer un nmero e indique que mes
del ao corresponde a dicho nmero.
Private Sub CMDMESClick()
Dim A As String
A = TXT1.Text
If (A <= 12) Then
If (StrComp(A, "1") = 0) Then
MsgBox ("ENERO")
End If
If (StrComp(A, "2") = 0) Then
MsgBox ("FEBRERO")
End If
If (StrComp(A, "3") = 0) Then
MsgBox ("MARZO")
End If
If (StrComp(A, "4") = 0) Then
MsgBox ("ABRIL")
End If
If (StrComp(A, "5") = 0) Then
MsgBox ("MAYO")
End If
If (StrComp(A, "6") = 0) Then
MsgBox ("JUNIO")
End If
If (StrComp(A, "7") = 0) Then
MsgBox ("JULIO")
End If
If (StrComp(A, "8") = 0) Then
MsgBox ("AGOSTO")
End If
If (StrComp(A, "9") = 0) Then
MsgBox ("SEPTIEMBRE")
End If
If (StrComp(A, "10") = 0) Then
MsgBox ("OCTUBRE")
End If
If (StrComp(A, "11") = 0) Then
MsgBox ("NOVIEMBRE")
End If
If (StrComp(A, "12") = 0) Then
MsgBox ("DICIEMBRE")
End If
Else
MsgBox ("NO EXISTE EL MES")
End If
End Sub
48.- Disear un programa que permita leer un nmero e indique que da
de la semana corresponde a dicho nmero.

Private Sub CMDSEMANA_Click()


Dim A As String
A = TXT1.Text
If A(<=7) Then
If A =1 Then
MsgBox ("LUNES")
End If
If A=2 Then
MsgBox ("MARTES")
End If
If A = 3 Then
MsgBox ("MIERCOLES")
End If
If A= 4
MsgBox ("JUEVES")
End If
If A = 5 Then
MsgBox ("VIERNES")
End If
If A = 6 Then
MsgBox ("SABADO")
End If
If A = 7 Then
MsgBox ("DOMINGO")
End If
Else
MsgBox ("NO EXISTE EL DIA")
End If
End Sub
49.-Disear un programa que permita realizar el cambio de moneda de
euros a bolivianos.
Private Sub cmdcalcular_Click()
Dim e As Double
Dim b As Double
Dim cab As Double
e = InputBox("ingrese la cantidad q desee cambiar")
b = InputBox("ingrese el cambio actual")
cam = (e * b)
MsgBox (" usted tiene: " & cam)
End Sub
50.- Realizar un programa que permita verificar la cuenta de un usuario.
Private Sub CMDINICIO_Click()

Dim A As String
Dim B As String
Dim A1 As String
Dim A2 As String
A = txtA.Text
A1 = "Javier"
B = txtB.Text
A2 = "Solis"
If (StrComp(A, A1) = 0) Then
MsgBox (" BIENBENIDO " & A)
Else
MsgBox ("USUARIO INCORECTO")
End If
End Sub
51.- Disear un programa que permita hallar la raz cuadrada de un
nmero ledo.
Private Sub cmdraiz_Click()
Dim b As Integer
Dim raiz As Integer
b = txtb.Text
raiz=(Sqr(b))
MsgBox (La raiz cuadrada es: & raz)
End Sub
52.- Disear un programa que permita leer un nmero y elevarlo a una
potencia.
Private Sub cmdpotencia_Click()
Dim A As Integer
Dim b As Integer
Dim pot As Integer
A = txtA.Text
b = InputBox(Ingrese la Potencia)
pot = (A^b)
MsgBox (El Resultado es: & pot)
End Sub

53.- Disear un programa que permita leer dos nmeros y pueda


compararlos.
Private Sub cmdcompararClick()

Dim A As Integer
Dim B As Integer
A = txtA.Text
B = txtB.Text
If (A > b) Then
MsgBox ("A ES MAYOR QUE B " & A)
End If
If (B > A) Then
MsgBox (" B ES MAYOR QUE A" & b)
End If
If (A = B) Then
MsgBox ("LOS NUMEROS SON IGUALES")
End If
End Sub
54.- Disear un programa que permita tranformar un nmero de grados a
radianes.
Private Sub cmdConvertir_Click()
Dim A As Integer
Dim RAD As Double
A = TXT1.Text
RAD = MsgBox("TU RESULTADO ES:" & ((A / 360) * 6.28))
End Sub
55.- Disear un programa que calcule la superficie de un triangulo en
funcin de la base y la altura.
Private Sub cmdcalcular_Click()
Dim a As Double
Dim b As Double
Dim sum As Double
a = InputBox("altura")
b = InputBox("base")
sup = (b * a)
MsgBox ("la superficie es:" & sup)
End Sub
56.- Disear un programa que permita leer un nmero en Km y muestre
la transformacin a m, m/min, m/s y m/cen.
Private Sub CMDCOMBERTIR_Click()
Dim a As Double
a = TXT1.Text
MsgBox ("metros: " & a * 1000)
MsgBox ("m/min: " & (a * 1000) / (60))
MsgBox ("m/s: " & ((a * 1000) / (60)) / (60))
MsgBox ("m/cen: " & (((a * 1000) / (60)) / (60)) / (100))
End Sub
57.- Disear un programa que permita hallar el rea y volumen de una
esfera.

Private SubcmdEsf_Click()
Dim R As Double
Dim V As Integer
Dim A As Integer
R=InputBox(Radio)
A=4*3.14*(R^2)
V=(4*3.14*(R^2))/3
If R>0 Then
lblA.caption=(El area es:& A)
lblV.caption=(El volumen es:& V)
Else
MsgBox(Ingrese radio )
End If
End Sub
58.-Disear un programa que permita hallar el rea y volumen de un
cubo.
Private SubcmdCub_Click()
Dim L As Double
Dim V As Double
Dim A As Double
L=InputBox(Lado)
A=12*L
V=L^3
If L>0 Then
lblA.caption=(El area es:& A)
lblV.caption=(El volumen es:& V)
Else
MsgBox(Ingrese Lado )
End If
End Sub
59.-Disear un programa que permita hallar el volumen de un tubo.
Private SubcmdTub_Click()
Dim R1 As Double
Dim R2 As Double
Dim H As Double
Dim V As Double
R1=InputBox(Radio 1)
R2=InputBox(Radio 2)
H=InputBox(Altura)
V=(2*3.14*H)*((R1+R2)/2)(R2-R1)
If R2>R1 Then
lblV.caption=(El volumen es:& V)
Else
MsgBox(Asegrese de introducir los radios respectivamente )
End If
End Sub
60.-Disear un programa que muestre el numero literal del 1 al 10
Private Subnumlit_Click()

Dim n As Integer
n=InputBox(Numero)
If (n>=1 And n<=10) Then
If n = 1 Then
MsgBox(Uno)
End If
If n = 2 Then
MsgBox(Dos)
End If
If n = 3 Then
MsgBox(Tres)
End If
If n = 4 Then
MsgBox(Cuatro)
End If
If n = 5 Then
MsgBox(Cinco)
End If
If n = 6 Then
MsgBox(Seis)
End If
If n = 7 Then
MsgBox(Siete)
End If
If n = 8 Then
MsgBox(Ocho)
End If
If n = 9 Then
MsgBox(Nueve)
End If
If n = 10 Then
MsgBox(Diez)
End If
Else
MsgBox(Ingrese nmero entre 1 y 10)
End If
End Sub

You might also like