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 ConsoleApplication7
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Unesite riječ: ");
- string palindrom = Console.ReadLine();
- bool nesto = Program.dalijepal(palindrom);
- Console.WriteLine("Riječ je palindrom: {0}", nesto);
- Console.ReadLine();
- }
- public static bool dalijepal(string riječ)
- {
- bool palindrom=true;
- for(int i=1; i<riječ.Length; i++)
- {
- if (riječ[i] != riječ[riječ.Length - i-1] && riječ[i] != riječ[riječ.Length - i-1] + 'A')
- {
- palindrom=false;
- break;
- }
- }
- return palindrom;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement