Created
January 14, 2020 18:02
-
-
Save abhilash0001/7435cc913abb3e95aee69bc94763ec83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal string isPalindrome(string str) | |
{ | |
bool flag = false; | |
if (!string.IsNullOrEmpty(str)) | |
{ | |
for (int i = 0, j = str.Length -1; i < str.Length /2; i++, j--) | |
{ | |
if (str[i] != str[j]) | |
{ | |
flag = false; | |
break; | |
} | |
else | |
flag = true; | |
} | |
} | |
return flag ? "Palindrome" : "Not Palindrome"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment