add Programmyday form github
This commit is contained in:
10
PalindromeExtention/PalindromeExtention.csproj
Normal file
10
PalindromeExtention/PalindromeExtention.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>
|
||||
26
PalindromeExtention/Program.cs
Normal file
26
PalindromeExtention/Program.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
namespace PalindromeExtention
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
string input = "otto";
|
||||
Console.WriteLine(input.Palindrom());
|
||||
}
|
||||
}
|
||||
static class PalindormExtention
|
||||
{
|
||||
public static bool Palindrom(this string input)
|
||||
{
|
||||
string index = input.Replace(" ","").ToLower();
|
||||
for (int i = 0; i < index.Length / 2; i++)
|
||||
{
|
||||
if (index[i] != index[index.Length - i - 1])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user