Ad

Sunday, July 14, 2013

Palindrome of a Given a String?


Overview:
       In this article i would like to publish about a Palindrome of a string

Description:
        Reverse of a given string is equal to the original string then it is a palindrome of a string.

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

namespace pr
{
    class Program
    {
        static void Main(string[] args)
        {
            string s ="";
            Console.WriteLine("Enter A String");
            string ss = Console.ReadLine();
            for (int i = ss.Length - 1; i >= 0; i--)
            {
                s =s+ss[i];
            }
            if (s == ss)
            {
                Console.WriteLine("Palindrome.........");
            }
            else
            {
                Console.WriteLine("Not a Palindrome.........");
            }
            Console.ReadLine();

        }
    }
}

OutPut:

Palindrome


No comments: