How to check palindrome in

In so many time, they will ask this question in interview to check the programming skill of developer.

How can check the palindrome string like this

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;

public partial class Program_Palindrom_of_String : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)

protected void Button1_Click(object sender, EventArgs e)
string s = TextBox1.Text.ToString();
string str = string.Empty;
for (int j = s.Length-1; j >= 0; j–)
//store the reverse string
str = str + s[j];
//check with input value
if (s == str)
Label1.Text = s + " is palindrom";
Label1.Text = s + " is not palindrom";


2 thoughts on “How to check palindrome in

  1. vidhya June 20, 2012 / 8:39 am

    thank u its useful for me

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.