add Programmyday form github
This commit is contained in:
10
EvenOrOddExtention/EvenOrOddExtention.csproj
Normal file
10
EvenOrOddExtention/EvenOrOddExtention.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>
|
||||
22
EvenOrOddExtention/Program.cs
Normal file
22
EvenOrOddExtention/Program.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace EvenOrOddExtention
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
int input = 105;
|
||||
Console.WriteLine(input.EvenOrOdd());
|
||||
}
|
||||
}
|
||||
static class EvenOrOddExtention
|
||||
{
|
||||
public static string EvenOrOdd(this int input)
|
||||
{
|
||||
if (input % 2 != 0)
|
||||
{
|
||||
return "Odd";
|
||||
}
|
||||
return "Even";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user