C# program to check whether a given string is a palindrome
Program.cs
Console.WriteLine("———————————————————————————————————————————");Console.WriteLine("Program to check string is palindrome | not");Console.WriteLine("———————————————————————————————————————————");Console.Write("Enter the string ");strings=Console.ReadLine()!;Console.WriteLine("\nLength of a string is "+s.Length);stringr=newstring(s.ToCharArray().Reverse().ToArray()!);Console.WriteLine("\nReverse string is "+r);if(s==r){Console.WriteLine("\nString is palindrome");}else{Console.WriteLine("\nString is not palindrome");}Console.WriteLine("———————————————————————————————————————————");
Output
kodingwindow@kw:~/csharp$ dotnet run
———————————————————————————————————————————
Program to check string is palindrome | not
———————————————————————————————————————————
Enter the string NAAN
Length of a string is 4
Reverse string is NAAN
String is palindrome
———————————————————————————————————————————
kodingwindow@kw:~/csharp$
Dear User, Thank you for visitng KodingWindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.
Dear User, We are grateful for your interest in the KodingWindow Android app. We intend to soon make it available on the Google Play Store. Currently, you need to install apk manually. Would you like to get the app? Minimum Requirement(s): Android 10