using System;
using System.Collections.Generic;
using System.Text;
namespace Exercise_02___Palindromes
{
class Program
{
//string aword;
static void Main(string[] args)
{
bool wResult;
Console.WriteLine("Palindrome Checker");
for (int x = 0; x < 20; x++)
{
Console.Write("=");
}
Console.WriteLine();
Console.Write("Input String : ");
string aword = Console.ReadLine();
clsCheckWord CheckWord = new clsCheckWord();
CheckWord.Givenword = aword;
int ix = CheckWord.isPalindrome();
if (ix == 1)
{
Console.Write("Result : A Valid Palindrome");
}
else
{
Console.Write("Result : Not A Palindrome");
}
Console.ReadLine();
}
}
}
Class Filename : clsCheckWord.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace Exercise_02___Palindromes
{
class clsCheckWord
{
public clsCheckWord(){}
public string givenword="";
public string Givenword
{
get { return givenword; }
set { givenword = value; }
}
public int isPalindrome()
{
string tmpcomp="";
for (int x = 0; x < givenword.Length; x++)
{
tmpcomp = givenword.Substring(x, 1) + tmpcomp;
}
if (tmpcomp == givenword)
{
return 1;
}
else
{
return 0;
}
}
}
}