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

Is int an object in c#?

517


What is polymorphism in c sharp?

525


When would you use generics in your code c#?

492


How to find Percentage, name ,College from a resume or document ? How to export these values to other page in C#?

540


What does mean before a string in c#?

520






What do you mean by delegates and explain different types of delegates?

514


What is sealed class in c#?

521


What is verbatim string literal in c#?

471


How to add a readonly property in c#.net

496


explain the three services model commonly know as a three-tier application.

550


How do namespaces work?

528


What is a dictionary in c#?

498


Why do we use readonly in c#?

493


How do you create user defined data types in c#?

527


What is the difference between structure and class in c#?

473