1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2025-05-18 12:02:53 +02:00

feat(solutions): add is-palindrome/cs/function

This commit is contained in:
Divlo
2021-09-10 22:43:35 +02:00
parent 2e15a21206
commit 02bfe7454f
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,3 @@
# is-palindrome/cs/function
Created by [@Divlo](https://github.com/Divlo) on 10 September 2021.

View File

@ -0,0 +1,26 @@
using System;
namespace Solution
{
class Program
{
static void Main()
{
string line = Console.ReadLine();
line = line.ToLower().Replace(" ", "");
string reverse = "";
for (int index = line.Length - 1; index >= 0; index--)
{
reverse += line[index];
}
if (line == reverse)
{
Console.WriteLine("true");
}
else
{
Console.WriteLine("false");
}
}
}
}