Created
January 11, 2021 23:00
-
-
Save Ts-Pytham/7b6f0eb4c275062c4aa05313384584ad to your computer and use it in GitHub Desktop.
Función que calcula las palabras palíndromas
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
static bool Palindroma(string palabra) | |
{ | |
palabra = palabra.Replace(" ", ""); | |
palabra = palabra.ToLower(); | |
int len = palabra.Length; | |
for(int i = 0; i != len - 1; ++i) | |
{ | |
if (palabra[i] != palabra[len - 1]) | |
return false; | |
len--; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment