Congratulations to all monthly winners of May 2013 !!! They have won INR 2900 cash and INR 27497 worth prize.
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 9797 |  Welcome, Guest!   Register  Login
 Home > Code Snippets > C# > palindrome programe how can print palindrome write programe for palindrome user input to show palindrome programe input string show palindrome ...
Ubaid

palindrome programe how can print palindrome write programe for palindrome user input to show palindrome programe input string show palindrome

 Code Snippet posted by: Ubaid | Posted on: 4/24/2012 | Category: C# Codes | Views: 985 | Status: [Member] | Points: 40 | Alert Moderator   
Ads

Note: Create new Console application from dotnet or simple write the following text in note paid then execute..
any way ...

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

namespace palindromeExample //(this will be your project name like create new application and write the name)
{
public class Program
{
public void Palindrome(string input) //(this is a method name)
{
string getInput = input; //(take input from user )
int length = getInput.Length;
string strCmp = "";
for (int j = length-1; j>=0; j--)
{
strCmp = strCmp + getInput[j]; //(get one by one user input and reverse)
}
if (strCmp == getInput) //(check condition is palindrome or not)
{
Console.WriteLine("this is palinderome");
}
else
{
Console.WriteLine("not vlaid palindrome....");
}
Console.WriteLine(strCmp);
}
static void Main(string[] args)
{
string UsrInput = "";
Console.WriteLine("Enter the input value:\n");
UsrInput = Console.ReadLine();
if (UsrInput != "")
{
Program objPrg = new Program();
objPrg.Palindrome(UsrInput);
}
else
{
Console.WriteLine("enter value...");
}
Console.Read(); // using this line screen will not disappear..

}



}
}

Ubaid
Found interesting? Add this to:


 Responses

T.Saravanan
Posted by: T.Saravanan | Posted on: 4/25/2012 | Level: Silver | Status: [Member] [MVP] | Points: 10 | Alert Moderator 

Hi,

Kindly post your code inside the code tag.

Thanks,
T.Saravanan

>> Write Response - Respond to this post and get points

More codes snippets

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 6/18/2013 10:12:23 PM