Write code for palindrome?

Answer Posted / manindra agrawal

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


class plaindrome
{
public static void Main()
{

string str1="";
int n,i=0;
int status=0;
System.Console.WriteLine("Enter the value...");

str1=Console.ReadLine(); // accept the value from the user
int len;
len=str1.Length; //calculating Lenght of the string
n=len;
while(i<n/2)
{

if(str1[i]==str1[n-1])
{
status=1;
i++;
n--;
}

else
status=0;
break;
}

if(status==1)
System.Console.WriteLine("Given string is plaindrom");

else
System.Console.WriteLine("Given String is not Plaindrome");
}

}

Is This Answer Correct ?    7 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is aws serverless?

497


Explain states of a thread in c#?

526


what class is underneath the sortedlist class?

549


Is it possible to inline assembly or il in c# code?

525


What are the benefits of using generics?

469






What does do in c#?

536


What is the base class for array types?

562


Define an assembly in .net?

517


What is the purpose of private constructor in c#?

546


What does it mean to override a method?

467


Why use “using” in c#?

522


What are delegates?

794


Explain about WSDL

593


What is the default value of string in c#?

557


In a site to turn off cookies for one page which method is followed?

505