Created
June 27, 2016 05:32
-
-
Save Chubek/4c999c5a1926e7851c1db11fd08a3ebb to your computer and use it in GitHub Desktop.
Check for Palindrome
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 Palindrome_Check | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string word = Console.ReadLine().ToLower(); | |
char[] wordSplit = word.ToCharArray(); | |
Array.Reverse(wordSplit); | |
string reversedWord = new string(wordSplit); | |
string palindromeStatus; | |
if (word.Equals(reversedWord)) | |
{ | |
palindromeStatus = "is"; | |
} | |
else | |
{ | |
palindromeStatus = "is not"; | |
} | |
string wordUpperCase = System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(word); | |
Console.WriteLine("{0} reversed is {1} which means {0} {2} a palindrome.", wordUpperCase, reversedWord, palindromeStatus); | |
Console.ReadKey(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment