Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _9._PalindromeIntegers
- {
- class PalindromeIntegers
- {
- static void Main()
- {
- string input = null;
- while ((input = Console.ReadLine()) != "END")
- {
- bool isPalindrome = IsPalindrome(input);
- Console.WriteLine(isPalindrome.ToString().ToLower());
- }
- }
- static bool IsPalindrome(string num)
- {
- bool isPalindrome = false;
- for (int i = 0; i < num.Length / 2; i++)
- {
- int backwardIndex = num.Length - 1 - i;
- if (num[i] == num[backwardIndex])
- {
- isPalindrome = true;
- break;
- }
- }
- return isPalindrome;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement