Created
October 22, 2018 08:18
-
-
Save Retterath/d5f3fc7fd75653ecc271b14a4ff24ed5 to your computer and use it in GitHub Desktop.
Check if the given input is Palindrome (experiment)
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_Integers | |
{ | |
class Program | |
{ | |
public static void Main() | |
{ | |
while (true) | |
{ | |
string word = Console.ReadLine(); | |
if (word == "END") | |
{ | |
break; | |
} | |
string reversedWord = string.Empty; | |
for (int i = word.Length - 1; i >= 0; i--) | |
{ | |
reversedWord += word[i]; | |
} | |
bool isPalindrome = IsPalindrome(word, reversedWord); | |
Console.WriteLine(isPalindrome == true ? "true" : "false"); | |
} | |
} | |
public static bool IsPalindrome(string word, string reversedWord) | |
{ | |
return word == reversedWord; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment