Numero Capicua Visual Basic
Obtener Numero Capicua de 3 Cifras en VISUAL BASIC 2010
Dim num, uni, aux, dec, cen As Integer
Dim rpta As String
Console.Write("Ingrese Numero de 3 Cifras:")
num = Console.ReadLine
If num >= 100 And num <= 999 Then
cen = num \ 100
aux = num Mod 100
dec = aux \ 10
uni = aux Mod 10
If cen = uni Then
rpta = "Numero es Capicua"
Else
rpta = "Numero no es Capicua"
End If
Else
rpta = "Numero fuera de intervalo"
End If
Console.WriteLine(rpta)
Console.ReadKey()
'Prof. jhonatan abal mejia
Dim num, uni, aux, dec, cen As Integer
Dim rpta As String
Console.Write("Ingrese Numero de 3 Cifras:")
num = Console.ReadLine
If num >= 100 And num <= 999 Then
cen = num \ 100
aux = num Mod 100
dec = aux \ 10
uni = aux Mod 10
If cen = uni Then
rpta = "Numero es Capicua"
Else
rpta = "Numero no es Capicua"
End If
Else
rpta = "Numero fuera de intervalo"
End If
Console.WriteLine(rpta)
Console.ReadKey()
'Prof. jhonatan abal mejia
Comentarios