Advertisement
Guest User

Untitled

a guest
Oct 21st, 2018
717
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Test2
  4. {
  5. class Program
  6. {
  7. public static void Main()
  8. {
  9. PrintIfPalindrome();
  10. }
  11.  
  12. public static void PrintIfPalindrome()
  13. {
  14. string reversedString = string.Empty;
  15.  
  16. while (true)
  17. {
  18. string inputedString = Console.ReadLine();
  19.  
  20. if (inputedString == "END")
  21. {
  22. break;
  23. }
  24.  
  25. for (int i = inputedString.Length - 1; i >= 0; i--)
  26. {
  27. reversedString += inputedString[i];
  28. }
  29.  
  30. if (reversedString == inputedString)
  31. {
  32. Console.WriteLine("true");
  33. }
  34.  
  35. else
  36. {
  37. Console.WriteLine("false");
  38. }
  39. }
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement