add Programmyday form github
This commit is contained in:
28
Palindrom/IsPalindrom.cs
Normal file
28
Palindrom/IsPalindrom.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Palindrom
|
||||
{
|
||||
internal class IsPalindrom
|
||||
{
|
||||
private string _text;
|
||||
public bool IstDasEinPalindrom(string text)
|
||||
{
|
||||
this._text = text.ToLower();
|
||||
this._text = text.Replace(" ", "");
|
||||
|
||||
for (int i = text.Length - 1; i < 0; i--)
|
||||
{
|
||||
this._text.Append(text[i]);
|
||||
}
|
||||
if (this._text == text)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Palindrom/Palindrom.csproj
Normal file
10
Palindrom/Palindrom.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
14
Palindrom/Program.cs
Normal file
14
Palindrom/Program.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.Threading.Channels;
|
||||
|
||||
namespace Palindrom
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
IsPalindrom palindrom = new IsPalindrom();
|
||||
string x = Console.ReadLine();
|
||||
Console.WriteLine(palindrom.IstDasEinPalindrom(x));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user