Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace _09._Palindrome_Integers
- {
- class Program
- {
- static void Main(string[] args)
- {
- string comand = Console.ReadLine();
- while (comand != "END")
- {
- bool isPalindrome = false;
- bool palindrome= FinePalindrome(comand, isPalindrome);
- if (palindrome==true)
- {
- Console.WriteLine("true");
- }
- else
- {
- Console.WriteLine("false");
- }
- comand = Console.ReadLine();
- }
- }
- static bool FinePalindrome(string comand, bool isPalindrome)
- {
- string newSrting = string.Empty;
- for (int i = comand.Length-1; i>=0 ; i--)
- {
- char symbol = comand[i];
- newSrting += symbol;
- if(newSrting == comand)
- {
- isPalindrome = true;
- }
- }
- return isPalindrome;
- }
- }
- }
Add Comment
Please, Sign In to add comment