Palindrome check in C#
Palindrome checks in C#
using System; public class Program { public static void Main() { Console.WriteLine("Palindrome check in C#\n"); 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"); } } } }DEMO
Palindrome check in C#
Reviewed by Bhaumik Patel
on
7:15 AM
Rating: