Skip to content

Instantly share code, notes, and snippets.

@Retterath
Created October 22, 2018 08:18
Show Gist options
  • Save Retterath/d5f3fc7fd75653ecc271b14a4ff24ed5 to your computer and use it in GitHub Desktop.
Save Retterath/d5f3fc7fd75653ecc271b14a4ff24ed5 to your computer and use it in GitHub Desktop.
Check if the given input is Palindrome (experiment)
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