.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Articles >> General >> Post New Resource Bookmark and Share   

 Subscribe to Articles

How to Write a Palindrome Programme using C# ?

Posted By:Syed Shakeer Hussain       Posted Date: April 11, 2009    Points: 10    Category: General    URL: http://www.dotnetspark.com  

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");

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




OutPut: Enter a String
madam is palindrome
 Subscribe to Articles


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend