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


namespace Palindrome
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] str = new char[10];
            Console.WriteLine("Enter The Palindrome Series(Max 10 Characters)");
            str = Console.ReadLine().ToCharArray();
            Console.WriteLine(CheckPalindrome(str));
        }
        private static bool CheckPalindrome(char[] mystring)
        {
            int startchar;
            int lastchar;
            startchar=0;
            lastchar=mystring.Length -1;
            while(startchar<lastchar)
            {
                if(mystring[startchar]==mystring[lastchar])
                {
                    startchar++;
                    lastchar--;

                }
                else
                {
                    return false;

                }
            }
            return true;

         }

        }
     }

how to hold the screen of the console ? As i am writing Console.ReadLine() in the code to hold the screen , but there is no response and i am getting the same result the program get exit automatically..

Please HElp

This line

char[] str = new char[10];

You can get rid of everything after str as you replace what was created when you assign the ReadLine() result to it.

This article has been dead for over six months. Start a new discussion instead.