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.Text;
- using System.Threading.Tasks;
- namespace program
- {
- class palindrome
- {
- static void Main(string[] args)
- {
- int i = 0;
- List<string> dic = new List<string>();
- dic.Add("Ana");
- dic.Add("7007");
- dic.Add("Marcos");
- dic.Add("ReCoNoCeR");
- string[] arr = new string[dic.Count];
- foreach(string item in dic){
- arr[i] = item;
- i++;
- }
- for(int j = 0; j<arr.Length; j++){
- if(arr[j].ToLower() == Reverse(arr[j].ToLower())){
- Console.WriteLine("Es {0} palindrome",arr[j]);
- }
- else{Console.WriteLine("{0} no es palindrome",arr[j]);}
- }
- }
- public static string Reverse(string word){
- char[] charArray = word.ToCharArray();
- Array.Reverse(charArray);
- return new string(charArray);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement