Вы находитесь на странице: 1из 6

ACTIVIDAD DE LABORATORIO

Alumna: Rodriguez Iparraguirre ,Fiorella

EJERCICIO 1

Programa que redondee al decimal deseado


Imports System.Console
Module Module1
Sub Main()

Dim a As Long
Dim x As Integer
WriteLine("escriba su decimal que desee: ")
a = ReadLine()
WriteLine("escriba el decimal que desee redondear: ")
x = ReadLine()
a = Math.Round(a, x)
WriteLine("su resultado es: " & a)
ReadLine()
Main()
End Sub

End Module

EJERCICIO 2

Programa que diga la velocidad de automóviles dependiendo a su velocidad y


decir si son lentos , rápidos o veloces.
Module Module1

Sub Main()
Console.Title = "VELOCIDAD MAXIMA DE AUTOMOVILES "
Dim vel As Integer
Console.WriteLine("ingrese la velocidad maxima de su automovil: ")
vel = Console.ReadLine()
Select Case vel
Case 0 To 15
Console.WriteLine("la velocidad a la que va el automovil es:
LENTO")

Case 16 To 50
Console.WriteLine("la velocidad a la que va el automovil es:
RAPIDO")
Case 51 To 10000
Console.WriteLine("la velocidad a la que va el automovil es:
VELOZ")
Case Else
Console.WriteLine("ERROR, ingrese velocidades (km/h) positivas")
End Select
Console.ReadLine()
Main()

End Sub
End Module

EJERCICIO 3

Juego donde adivinas el número que la computadora está “pensando”.


Imports System.Console
Module Module1
Sub Main()

Dim n1, n2 As Integer


Dim acierto As Integer = 0
Dim continuar As Boolean = True
Dim msm As String

While continuar = True


WriteLine("ingrese un numero menor o igual al que estoy pensando
(intervalo de 1 a 10): ")
n1 = ReadLine()
n2 = Rnd() * 10 + 1 'rnd:valor numero aleatorio ,regresa valor
decimal del 0 al 1 sin incluir 0 y 1,
'pero convertimos a entero *10; si es cero arroja cero entonces se
agrega 1
If n1 <= n2 Then
WriteLine("¡FELICIDADES, pense el numero: " & n2) '+ cstr tambien
concatena
acierto = acierto + 1 'acierto+=1
'en caso de no acertar
Else
continuar = False
End If
End While
Select Case acierto
Case acierto = 0
msm = "Usted no acerto nada jajaja"
Case acierto = 1
msm = "Usted acerto una vez"
Case Else
msm = "Felicidades ,usted acerto " & acierto & " veces"
End Select

WriteLine(msm)
ReadLine()
Main()

End Sub

End Module
EJERCICIO 4

Tabla de multiplicar
Imports System.Console
Module Module1

Sub Main()
Dim n1 As Integer
WriteLine("escribe el numero del cual deseas la multiplicacion: ")
n1 = ReadLine()

For i As Integer = 1 To 10
WriteLine(n1.ToString + " x " + i.ToString + "=" + CStr(n1 * i))

Next
ReadLine()
Main()
End Sub
End Module

EJERCICIO 5

Triangulo de letras
Imports System.Console
Module Module1
Sub Main()
Dim s As String

For i As Integer = 65 To 90 'en el codigo ashki el i=65 es a y el i=90 es


z; esto incrementara de uno en uno de 65 a 90
s = ""
For j As Integer = 90 To i Step -1 'bajara de 90 al 89, etc hasta qe
sea 65
s = s + Chr(j) 'chr tranforma numeros a letras

Next
WriteLine(s)
Next
ReadLine()
End Sub
End Module
EJERCICIO 6

Triangulo de asteriscos
Imports System.Console
Module Module1
Sub Main()
Dim x As Integer
x = 9
For y = 1 To 9
For i = 1 To x
Write("*")
Next
WriteLine()
x = x - 1
Next
ReadLine()

End Sub
End Module

EJERCICIO 7

Días de la semana
Module Module1

Sub Main()

Dim dia As String


Console.WriteLine("escriba un dia de la semana")
dia = Console.ReadLine()
Select Case dia
Case 1
Console.WriteLine("el dia es domingo")
Case 2
Console.WriteLine("el dia es lunes")
Case 3
Console.WriteLine("el dia es martes")
Case 4
Console.WriteLine("el dia es miercoles")
Case 5
Console.WriteLine("el dia es jueves")
Case 6
Console.WriteLine("el dia es vierne")
Case 7
Console.WriteLine("el dia es sabado")
Case Else
Console.WriteLine("ingrese un numero del 1 al 7")

End Select
Console.ReadLine()

End Sub

End Module
EJERCICIO 8
Identificar el número mayor
Module Module1

Sub Main()
Dim a, b, c As Integer
Console.WriteLine("escribe el primer numero: ")
a = Console.ReadLine()
Console.WriteLine("escribe el segundo numero: ")
b = Console.ReadLine()
Console.WriteLine("escribe el tercer numero: ")
c = Console.ReadLine()

If a > b And a > c Then


Console.WriteLine("el mayor es el primer numero" & a)
If b > a And b > c Then
Console.WriteLine("el mayor es el segundo numero" & b)
If c > a And c > b Then
Console.WriteLine("el mayor es el tercer numero" & c)
If c = a = b Then
Console.WriteLine("los tres numeros son iguales " & a = b
= c)

End If

End If
End If
End If
Console.ReadLine()
Main()

End Sub

End Module

EJERCICIO 9

Tabla de sumar del 10


Module Module1

Sub Main()
Dim r As Integer = 0
Console.WriteLine("TABLA DE SUMAR DEL 10")
For s1 = 1 To 10
For s2 = s1 To 10
r = s1 + s2
Console.WriteLine("" & s1 & " + " & s2 & " = " & r)
Next
Next
Console.ReadLine()
End Sub
End Module
EJERCICIO 10
Identifica los números primos
Module Module1

Sub Main()
Dim n1 As Integer
Dim respuesta As Boolean = True

Console.WriteLine("escriba un numero :")


n1 = Console.ReadLine()
For i As Integer = 2 To n1 - 1
If n1 Mod 2 = 0 Then
respuesta = False
End If

Next
If respuesta = False Then
Console.WriteLine("el numero no es primo ")
Else
Console.WriteLine("el numero es primo")
End If
Console.ReadLine()
End Sub

End Module

Вам также может понравиться