Sei sulla pagina 1di 9

PROGRAMACION EN VISUAL BASIC

1. Programa en el cual se ingrese la distancia que existe en dos vehculos y sus respectivas velocidades Hallar el tiempo de alcance y el tiempo de encuentro?

Private Sub Command1_Click() Dim v1, v2, d, te, ta As Double v1 = Val(Text1.Text) Text1.Text = "" v2 = Val(Text2.Text) Text2.Text = "" d = Val(Text3.Text) Text3.Text = "" te = (v1 + v2) / d ta = (v1 - v2) / d Text4.Text = te Text5.Text = ta End Sub

Private Sub Command2_Click() Text4.Text = "" Text5.Text = "" End Sub

2. Programa en el cual se ingrese la distancia y el tiempo de un vehculo Hallar la aceleracin?

Private Sub Command1_Click() Dim t, d, a, v As Double t = Val(Text1.Text) Text1.Text = "" d = Val(Text2.Text) Text2.Text = "" v=d/t a=v/t Text3.Text = a End Sub

3. Programa que devuelva la altura y la velocidad final de un cuerpo que se deja caer ingresando nicamente el tiempo.

Private Sub Command1_Click() Dim t, h, vf As Double t = Val(Text1.Text) Text1.Text = "" vf = 10 * t h = (vf / 2) * t Text2.Text = vf Text3.Text = h End Sub

4. Convertir el ngulo sexagesimal g m s a grados, minutos y segundos centesimales.

Private Sub Command1_Click() Dim gs, ms, ss, gra, min, seg As Integer Dim s, c As Double gs = Val(Text1.Text) ms = Val(Text2.Text) ss = Val(Text3.Text) gra = Val(Text4.Text) min = Val(Text5.Text) seg = Val(Text6.Text) s = gs + ms / 60 + ss / 3600 c = (10 * s) / 9 gra = (c) min = ((c - gra) * 100) seg = (((c - gra) * 100) - min) * 100 Text4.Text = gra Text5.Text = min Text6.Text = seg End Sub

5. Programa en el que se ingrese la masa atmica y la cantidad de neutrones para que nos devuelva el nmero atmico, la cantidad de electrones y protones .

Private Sub Command1_Click() Dim s, p, e, a, n As Double a = Val(Text1.Text) n = Val(Text2.Text) p=a-n z=p e=p Text3.Text = p Text4.Text = z Text5.Text = e End Sub

6. Programa en el que se ingresa el tiempo en el que se demora en llegar el sonido de una detonacin a cierto lugar Calcular la distancia donde se realiz la detonacin?

Private Sub Command1_Click() Dim t, d As Double t = Val(Text1.Text) d = 340 * t Text2.Text = d End Sub

7. Ingresando el radio de una esfera y la altura de un casquete determinar el rea y volumen de dicho casquete esfrico.

Private Sub Command1_Click() Dim r, h, a, v As Double r = Val(Text1.Text) h = Val(Text2.Text) a = 2 * 3.1416 * r * h v = (3.1416 * (h ^ 2) * ((3 * r) - h)) / 3 Text3.Text = a Text4.Text = v End Sub

8. Elaborar un programa en el que se ingrese una cantidad en gramos y convertirlas en onzas, libras, dinas y newton (1 onza = 28,349 gr; 1N = 105 dinas = 0.2248 libras; 1 libra = 453.592 gr).

Private Sub Command1_Click() Dim gramos, onzas, libras, dinas, newton As Double gramos = Val(Text1.Text) onzas = gramos / 28.349 libras = gramos / 453.592 dinas = (libras * 105) / 0.2248 newton = dinas / 105 Text2.Text = onzas Text3.Text = libras Text4.Text = dinas Text5.Text = newton End Sub

9. De la siguiente expresin: a = m * nb = (c + (m - x)) * 3y = (a * c) + nz = (a * b) yk = 2 * (x + y + z) + ((m + n) * (a + b + c)). Convertir grados Centgrados a grados Fahrenheit

Private Sub Command1_Click() Dim A, B, C, D, E, w, x, y, z A = Val(Text1.Text) B = Val(Text2.Text) C = Val(Text3.Text) D = Val(Text4.Text) w=A*B x = (D + (A - C)) * 3 y = (w * D) + B z = (w * x) - y E = 2 * (C + y + z) + ((A + B) * (w + x + D)) Text5.Text = E End Sub

Potrebbero piacerti anche