Advertisement
Iskrenov84

09. Palindrome Integers

Feb 10th, 2022
819
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. namespace P9._PalindromeIntegers
  4. {
  5.     internal class Program
  6.     {
  7.         static string reverseString (string input)
  8.         {
  9.             char[] charArray = input.ToCharArray ();
  10.             Array.Reverse (charArray);
  11.             return new string (charArray);
  12.         }
  13.         static void Main(string[] args)
  14.         {
  15.             string input =Console.ReadLine();
  16.  
  17.             while (input != "END")
  18.             {
  19.                 if (reverseString(input) == input)
  20.                 {
  21.                     Console.WriteLine("true");
  22.                 }
  23.                 else
  24.                 {
  25.                     Console.WriteLine("false");
  26.                 }
  27.                 input = Console.ReadLine();
  28.             }
  29.         }
  30.     }
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement