Check palindrom string in C# Programming

C# program To Check the String is palindrom or not 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace palindrom
{
    class Program
    {
        static void Main(string[] args)
        {
            string str, rev = "";
            Console.WriteLine(" Enter The String");
            str = Console.ReadLine();
            for (int i = str.Length - 1; i >= 0; i--)
            {
                rev += str[i].ToString();
            }
            if (rev == str)
            {
                Console.WriteLine("String is Palindrome", rev);
            }
            else
            {
                Console.WriteLine("String is not Palindrome ", rev);
            }
            Console.ReadKey();
        }
    }
}

OutPut : 

Previous
Next Post »