static void Main(string[] args)
{
Console.WriteLine("Enter a string to check Pallindrom.");
string str=Console.ReadLine();
string strRev = "";
for (int i = str.Length - 1; i >= 0; i--)
{
strRev += str[i];
}
if (str.ToUpper() == strRev.ToUpper())
{
Console.WriteLine("its a Pallidrom.");
Console.ReadLine();
}else
{
Console.WriteLine("its not a Pallidrom.");
Console.ReadLine();
}
}
{
Console.WriteLine("Enter a string to check Pallindrom.");
string str=Console.ReadLine();
string strRev = "";
for (int i = str.Length - 1; i >= 0; i--)
{
strRev += str[i];
}
if (str.ToUpper() == strRev.ToUpper())
{
Console.WriteLine("its a Pallidrom.");
Console.ReadLine();
}else
{
Console.WriteLine("its not a Pallidrom.");
Console.ReadLine();
}
}
No comments:
Post a Comment