Skip to content

Commit

Permalink
Ejercicio 11.- Identificar un palindromo en Visual Basic.NET [40]⛓️
Browse files Browse the repository at this point in the history
  • Loading branch information
programadornovato committed Jul 15, 2021
1 parent e850681 commit 33ddc66
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions VisualBasic/Program.vb
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,30 @@ Imports System
Module Program
'Este codigo escribe un texto en amarillo con fondo azul
Public Sub Main(args As String())
Dim perros = New String() {"Monte", "Chupacabras", "Mikey", "Solovino", "El chiquito"}
Console.WriteLine("CON FOR")
For i = 0 To perros.Length - 1
Console.WriteLine("El perro " & i & " es " & perros(i))
Next
Console.WriteLine("CON FOR EACH")
Dim j = 0
For Each perro In perros
Console.WriteLine("El perro " & j & " es " & perro)
j = j + 1
Next
Console.WriteLine("Humano ingresa un palindromo")
Dim texto = Console.ReadLine()
Dim textoCopia = texto
If texto IsNot Nothing Then
texto = texto.ToLower()
texto = texto.Replace(" ", "")
Dim longitud = texto.Length
Dim igual = True
Dim cont = 0
For indice = longitud - 1 To 0 Step -1
If (texto(indice) <> texto(cont)) Then
igual = False
Exit For
End If
cont = cont + 1
Next
If igual = True Then
Console.WriteLine("Felicidades humano el texto " & textoCopia & " si es palindromo")
Else
Console.WriteLine("Humano estupido el texto " & textoCopia & " no es palindromo")
End If
Else
Console.WriteLine("humano estupido te pedi que ingresarar un palindo y no escribiste nada")
End If
Console.Read()
End Sub
End Module

0 comments on commit 33ddc66

Please sign in to comment.