Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Numerics;
- namespace methods_exerci
- {
- class Program
- {
- static void Main(string[] args)
- {
- string text;
- while ((text = Console.ReadLine()) != "END")
- {
- Palindrome(text);
- }
- }
- static void Palindrome(string text)
- {
- List<string> number = new List<string>();
- for (int i = 0; i < text.Length; i++)
- {
- number.Add(text[i].ToString());
- }
- string palindrome = "true";
- for (int i = 0; i < number.Count - 1; i++)
- {
- string one = number[i];
- string two = number[number.Count - 1 - i];
- if (one != two)
- {
- palindrome = "false";
- }
- }
- Console.WriteLine(palindrome);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement