console Application for given string is plaindrome

Last post 05-10-2008 3:19 AM by soona. 2 replies.

Sort Posts:

  • console Application for given string is plaindrome

    05-10-2008, 1:19 AM
    • Loading...
    • soona
    • Joined on 05-07-2008, 4:26 AM
    • Posts 9

    hi ,

    i need code for given string is a plaindrome or not(reverse a string) in C#.net using Console Apllication with ouput .

    thank u for help.... reply now  

  • Re: console Application for given string is plaindrome

    05-10-2008, 2:49 AM
    Answer
    using System;

    class MyString
    {
    public static void Main()
    {
     
    IsPalindrome("xxxxxxxx"); 
    public static bool IsPalindrome(String strParam)
    {
    int iLength,iHalfLen;
    iLength=strParam.Length-1;
    iHalfLen=iLength/2;
    for(int iIndex=0;iIndex<=iHalfLen;iIndex++)
    {
    if(strParam.Substring(iIndex,1)!=strParam.Substring(iLength-iIndex,1))
    {
            
    console.writeline("not palindrome");
    return false;
    }
    }
        console.writeline("palindrome");
    return true;
    }

     }

    Hope it helps.

    -Manas
  • Re: console Application for given string is plaindrome

    05-10-2008, 3:19 AM
    Answer
    • Loading...
    • soona
    • Joined on 05-07-2008, 4:26 AM
    • Posts 9

     thank for reply
    its working....

Page 1 of 1 (3 items)