0% found this document useful (0 votes)
67 views6 pages

Dim As Integer

The document contains code snippets in Visual Basic that perform various tasks like: 1) Finding the minimum, maximum and median values from three input numbers 2) Converting Celsius to Fahrenheit 3) Getting a letter grade from a numeric grade 4) Checking if a number is prime 5) Calculating order totals from input codes 6) Getting the month name from a number 7) Getting sums of even and odd numbers from user input 8) Converting seconds to hours, minutes and seconds The code uses concepts like if/else statements, for loops, and select cases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views6 pages

Dim As Integer

The document contains code snippets in Visual Basic that perform various tasks like: 1) Finding the minimum, maximum and median values from three input numbers 2) Converting Celsius to Fahrenheit 3) Getting a letter grade from a numeric grade 4) Checking if a number is prime 5) Calculating order totals from input codes 6) Getting the month name from a number 7) Getting sums of even and odd numbers from user input 8) Converting seconds to hours, minutes and seconds The code uses concepts like if/else statements, for loops, and select cases.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Dim menor, medio, mayor As Integer

menor = txtnumero1.Text
medio = txtnumero2.Text
mayor = txtnumero3.Text

If menor < medio And menor < mayor Then


txtmenor.Text = menor
ElseIf medio < menor And medio < mayor Then
txtmenor.Text = medio
ElseIf mayor < menor And mayor < menor Then
txtmenor.Text = mayor
End If
If menor > medio And menor > mayor Then
txtmayor.Text = menor
ElseIf medio > menor And medio > mayor Then
txtmayor.Text = medio
ElseIf mayor > menor And mayor > medio Then
txtmayor.Text = mayor
End If

If txtmayor.Text > menor And txtmenor.Text < menor Then


txtmedio.Text = menor
ElseIf txtmayor.Text > medio And txtmenor.Text < medio Then
txtmedio.Text = medio
ElseIf txtmayor.Text > mayor And txtmenor.Text < mayor Then
txtmedio.Text = mayor
End If

Dim celcius As Integer


Dim fahrenheit As Double
celcius = txtcelcius.Text

fahrenheit = (9 / 5 * celcius) + 32
txtfahrenheit.Text = fahrenheit

Dim calificaciones As Integer


calificaciones = txtcalificaciones.Text

If calificaciones < 0 Or calificaciones > 10 Then


MessageBox.Show("Calificaciones desde 0 hasta 10", "ERROR",
MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
If calificaciones <= 10 And calificaciones >= 9 Then
txtletra.Text = "A"
ElseIf calificaciones <= 8 And calificaciones >= 7 Then
txtletra.Text = "B"
ElseIf calificaciones <= 6 And calificaciones >= 5 Then
txtletra.Text = "C"
ElseIf calificaciones >= 2 And calificaciones <= 4 Then
txtletra.Text = "D"
ElseIf calificaciones <= 1 And calificaciones >= 0 Then
txtletra.Text = "E"
End If

If txtletra.Text = "A" Or txtletra.Text = "B" Then


txtresultados.Text = "Aprobado"
ElseIf txtletra.Text = "C" Then
txtresultados.Text = "Recuperacin"
ElseIf txtletra.Text = "D" Or txtletra.Text = "E" Then
txtresultados.Text = "Reprobado"
End If

Dim resultado As Boolean = False


Dim Contador As Integer = 1
Dim suma As Integer
For numero = 50 To 285
resultado = True

For n As Integer = 50 To numero - 1


If numero Mod n = 0 Then
resultado = False
End If
Next

If resultado = True Then


txtnumeros.Text = txtnumeros.Text & numero & vbCrLf

suma = suma + numero


txtsuma.Text = suma
End If
Next

If txtingresecodigo.Text = "6754" Then


txtcantidad.Text = "4"
txtprecio.Text = 700
txtsubtotal.Text = 700 * 4
txtiva.Text = "12"
txttotal.Text = 700 * 4 * 1.12

'Marco Antonio Barco Pin

End If

If txtingresecodigo.Text = "2567" Then


txtcantidad.Text = "1"
txtprecio.Text = 1500
txtsubtotal.Text = 1500 * 1
txtiva.Text = "12"
txttotal.Text = 1500 * 1 * 1.12

End If

If txtingresecodigo.Text = "8543" Then


txtcantidad.Text = "3"
txtprecio.Text = 900
txtsubtotal.Text = 900 * 3
txtiva.Text = "12"
txttotal.Text = 900 * 3 * 1.12

End If

If txtingresecodigo.Text = "3823" Then


txtcantidad.Text = "5"
txtprecio.Text = 400
txtsubtotal.Text = 400 * 5
txtiva.Text = "12"
txttotal.Text = 400 * 5 * 1.12

End If

If txtingresecodigo.Text = "9085" Then


txtcantidad.Text = "2"
txtprecio.Text = 800
txtsubtotal.Text = 800 * 2
txtiva.Text = "12"
txttotal.Text = 800 * 2 * 1.12

End If
If txtingresecodigo.Text = "7632" Then
txtcantidad.Text = "6"
txtprecio.Text = 100
txtsubtotal.Text = 100 * 6
txtiva.Text = "0"
txttotal.Text = 100 * 6

End If

Dim numeros As Integer


numeros = txtnumero.Text

Select Case numeros


Case 1
txtmes.Text = "Enero"
Case 2
txtmes.Text = "Febrero"
Case 3
txtmes.Text = "Marzo"
Case 4
txtmes.Text = "Abril"
Case 5
txtmes.Text = "Mayo"
Case 6
txtmes.Text = "Junio"
Case 7
txtmes.Text = "Julio"
Case 8
txtmes.Text = "Agosto"
Case 9
txtmes.Text = "Septiembre"
Case 10
txtmes.Text = "Octubre"
Case 11
txtmes.Text = "Noviembre"
Case 12
txtmes.Text = "Dciembre"
Case Else

txtmes.Text = "El numero no es un mes"

End Select

Dim sumap, sumai, valor As Integer


Dim respuesta As String

Do
valor = InputBox("Digite nmero", "Capturar nmeros")
If valor Mod 2 = 0 Then
txtpar.Text = txtpar.Text & valor & vbCrLf
sumap = sumap + valor
respuesta = MsgBox("Desea Continuar (Si/No)",
MsgBoxStyle.YesNo)

Else
txtimpar.Text = txtimpar.Text & valor & vbCrLf
sumai = sumai + valor
respuesta = MsgBox("Desea Continuar (Si/No)",
MsgBoxStyle.YesNo)

End If
Loop While (respuesta = "6")
txtsumapar.Text = sumap
txtsumaimpar.Text = sumai
Dim horas, minutos, segundo, seg As Integer
seg = txttiemposegundo.Text

horas = Math.Floor(seg / 3600)


minutos = Math.Floor((seg - horas * 3600) / 60)
segundo = seg - (horas * 3600 + minutos * 60)

txthoras.Text = Trim(horas)
txtminutos.Text = Trim(minutos)
txtsegundo.Text = Trim(segundo)

You might also like