Created
April 19, 2014 16:15
-
-
Save chechedotmx/1fef4c8e941f9edae76d to your computer and use it in GitHub Desktop.
Palindromos de producto de 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace AldeaDigital | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
int rangoMenor = 100; | |
int rangoMayor = 999; | |
List<int> listaPalindromos = new List<int>(); | |
for (int i = rangoMenor; i <= rangoMayor; i++) | |
{ | |
for (int j = rangoMenor; j < rangoMayor; j++) | |
{ | |
int multiplicacion = i * j; | |
String multiplicacionString = multiplicacion.ToString(); | |
if (multiplicacionString.SequenceEqual(multiplicacionString.Reverse())) | |
{ | |
listaPalindromos.Add(multiplicacion); | |
} | |
} | |
} | |
Console.WriteLine(listaPalindromos.ToArray().Max() + " es el palindromo más grande derivado del producto de 2 números en el rango " + rangoMenor + " a " + rangoMayor); | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment