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;
- namespace ConsoleApplication11
- {
- class Program
- {
- static void Main(string[] args)
- {
- string Line;
- Console.WriteLine("Kérem a sort:");
- do
- {
- Line = Console.ReadLine();
- }
- while (Line.Length == 0);
- if (Palindrom(Line))
- {
- Console.WriteLine("A sor palindrom volt.");
- }
- else
- {
- Console.WriteLine("A sor nem volt palindrom.");
- }
- }
- static bool Palindrom(string Sor)
- {
- for (int i = 0, j = Sor.Length - 1; i < j; i++, j--) {
- if (Sor[i] != Sor[j])
- {
- return false;
- }
- }
- return true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement