Search
Winners

Win Prizes

Social Presence
Twitter Twitter LinkedIn YouTube Google

Like us on Facebook
Advertisements
Top Codes Author
Thu, 28-Aug-2014 Authors
All Time Authors
Satyapriyanayak
12160
Jayakumars
8120
Niladri.biswas
6000

Latest members | More ...


(Statistics delayed by 5 minutes)
 Codes

Palindrome in C#

Syedshakeer
Posted by Syedshakeer under C# on 2/17/2009 7:02:18 PM | Views : 33927 | Status : [Member]

How to Write a Palindrome Programme using C# ?

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

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args) {
string str=string .Empty ;
Console.WriteLine("Enter a String");
string s = Console.ReadLine();
int i = s.Length;
//we can get the Length of string by using Length Property

for (int j=i -1; j >= 0; j--)
{
str = str + s[j ];
}
if (str == s)
{


Console.WriteLine(s + " is palindrome");


}
else
{
Console.WriteLine(s + " is not a palindeome"); }

Console.WriteLine(str);

Console.Read();





}
}
}


OutPut: Enter a String
MadaM
Madam is palindrome


Syed Shakeer Hussain
Found interesting? Add this to:



Comments or Responses


Login to post response