It contains a program to reverse a string and to check whether a Entered string is palindrome or not.
  1. using System;
  2. namespace palindrome
  3. {
  4. class Program
  5. {
  6. static void Main(string[] args)
  7. {
  8. string s,revs="";
  9. Console.WriteLine(" Enter string");
  10. s = Console.ReadLine();
  11. for (int i = s.Length-1; i >=0; i--) //String Reverse
  12. {
  13. revs += s[i].ToString();
  14. }
  15. if (revs == s) // Checking whether string is palindrome or not
  16. {
  17. Console.WriteLine("String is Palindrome \n Entered String Was {0} and reverse string is {1}", s, revs);
  18. }
  19. else
  20. {
  21. Console.WriteLine("String is not Palindrome \n Entered String Was {0} and reverse string is {1}", s, revs);
  22. }
  23. Console.ReadKey();
  24. }
  25. }
  26. }