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

Home >> Code Snippets >> Visual Studio >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

palindrome using C#.NET

Posted By:Syed Shakeer Hussain       Posted Date: February 17, 2009    Points: 10    Category: Visual Studio    URL: http://www.dotnetspark.com  

How to Write a Palindrome Programmer in c#.NET

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


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

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