DotNet Mirror
  DNM facebook   DNM Google+   DNM Twitter   

C#.NET string palindrome program without using string functions

By Ashok Nalam on 15 Mar 2015 | Category: C# | Tagged: string palindrome .NET 
In this snippet we will write a program to check whether the given string is palindrome string or not with out using any built-in string function.
  Discuss Add Comment   |  
Add rating Rate this resource   

What is palindrome String?

"Palindrome string is a string that remains the same when its chars are reversed"


string 'wowow' is a palindrome string.
string 'dotnetmirror'- it not a palindrome string.


using System;
class PalindromeString
    static bool CheckPalindrome(string CheckString)
        if (CheckString == null || CheckString.Length == 0)
            return false;
        int strMaxIndex = CheckString.Length - 1;
        for (int i = 0; i < CheckString.Length / 2; i++)
            if (CheckString[i] != CheckString[strMaxIndex - i])
                return false;
        return true;
    public static void Main()
        Console.WriteLine("********** Palindrome string Check Example ********");
        Console.Write("Enter string to you want to check: ");
        string str = Console.ReadLine();
        if (CheckPalindrome(str))
            Console.WriteLine("{0} is a Palindrome String", str);
            Console.WriteLine("{0} is not a Palindrome String", str);



Example1 : Input =wowow (palindrome string)

Example2 : Input =dotnetmirror (not a palindrome string)
palindrome string: dotnetmirror

Example3 : Input =maddam(palindrome string)
  Discuss Add Comment    
Add rating Rate this resource   
About the Contributor
Member Since : 10 Dec 2012
Member Points (Level) : 9186  (Professional)
Location : INDIA
Home Page :
About : I am admin of this site.
Rate this resource
Add your Comment
Name Email WebSite
Captcha Refresh

Comments (0)
No comments found, click here to add comment.