tissiana

PalindromeIntigers

Oct 24th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.13 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace PalindromeIntigers
  8. {
  9.     class Program
  10.     {
  11.         static void Main()
  12.         {
  13.             while (true)
  14.             {
  15.                 string command = Console.ReadLine();
  16.                 string output = IfPalindromeInteger(command);
  17.  
  18.                 if(output == command)
  19.                 {
  20.                     Console.WriteLine("true");
  21.                 }
  22.                 if(output != command && command != "END")
  23.                 {
  24.                     Console.WriteLine("false");
  25.                 }
  26.                
  27.  
  28.                 if (command == "END")
  29.                 {
  30.                     break;
  31.                 }
  32.             }
  33.  
  34.         }
  35.         public static string IfPalindromeInteger(string command)
  36.         {
  37.             string result = string.Empty;
  38.  
  39.             for (int i = command.Length-1; i >=0; i--)
  40.             {
  41.                 char number = command[i];
  42.                 result += number;      
  43.             }
  44.             return result;
  45.  
  46.         }
  47.  
  48.     }
  49.  
  50. }
Add Comment
Please, Sign In to add comment