Skip to content

Commit dd404a5

Browse files
authored
Merge pull request deutranium#213 from gabrielhs1357/palindrome
implemented palindrome checking using c#
2 parents 99cfd88 + 3c2518a commit dd404a5

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
static void Main(string[] args)
2+
{
3+
string inputString, reverseString = string.Empty;
4+
5+
Console.Write("Enter a input: ");
6+
7+
inputString = Console.ReadLine();
8+
9+
if (inputString != null)
10+
{
11+
for (int i = inputString.Length - 1; i >= 0; i--)
12+
reverseString += inputString[i].ToString();
13+
14+
if (reverseString == inputString)
15+
Console.WriteLine("Palindrome!");
16+
17+
else
18+
Console.WriteLine("Not Palindrome");
19+
}
20+
21+
Console.ReadLine();
22+
}

0 commit comments

Comments
 (0)