- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- string initial = "";
- Console.WriteLine("Enter a String to check for Palindrome");
- string input = Console.ReadLine();
- int iLength = input.Length;
- if (iLength == 0)
- {
- Console.WriteLine("You did not enter the string");
- }
- else
- {
- for (int j = iLength - 1; j >= 0; j--)
- {
- initial = initial + input[j];
- }
- if (initial == input)
- {
- Console.WriteLine(input + " is palindrome");
- }
- else
- {
- Console.WriteLine(input + " is not a palindrome");
- }
- Console.Read();
- }
- }
- }
- }
- Enter a String to check for Palindrome
- MADAM
- MADAM is palindrome
- Enter a String to check for Palindrome
- RAJAN
- RAJAN is not a palindrome