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 ConsoleApplication10
- {
- class Program
- {
- static void Main(string[] args)
- {
- //ödev
- //dışarıdan string değer alsın.
- //tersten okunuşu ile düz okunuşu aynı olan ifadelere palindrom denir.
- //Kelimenin palindrome olup olmadığını bulan metot yazınız PalindromMu? parametre olarak dışarıdan bir string değer alsın ve
- Console.WriteLine(palindrom("madamil"));
- //nagihanesendal.blogspot.com
- }
- static bool palindrom(string deger)
- {
- bool durum = false;
- string tersi=string.Empty;
- for(int i=deger.Length-1;i>=0;i--)
- {
- tersi += deger[i];
- }
- for(int i=0;i<deger.Length/2;i++)
- {
- if(deger[i]==tersi[i])
- {
- durum = true;
- }
- else
- {
- durum = false;
- }
- }
- return durum;
- }
- }
- }
Add Comment
Please, Sign In to add comment