Advertisement
Hazem3529

palindrome

Jun 5th, 2015
486
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. namespace pandora
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             string word = Console.ReadLine();
  11.             string reversed=word;
  12.             int counter=0;
  13.             for (int i = 0 ,j=word.Length-1; i < word.Length; i++,j--)
  14.             {
  15.                 if (reversed[j] == word[i])
  16.                 {
  17.                     counter++;
  18.                 }
  19.                
  20.             }
  21.  
  22.             if (counter==word.Length)
  23.             {
  24.                 Console.WriteLine("its a palindrome dude");
  25.             }
  26.             else Console.WriteLine("no");
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement