Skip to content

Commit 1f4d25c

Browse files
committed
Adding Coin Flip logic
1 parent e988ea5 commit 1f4d25c

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

CSharp/CoinFlip/CoinFlip.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
</Project>

CSharp/CoinFlip/Program.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
3+
namespace Program
4+
{
5+
class Program
6+
{
7+
static void Main(string[] args)
8+
{
9+
Random rand = new Random();
10+
11+
int coin = rand.Next(0, 2);
12+
13+
Console.Write("Coin flip result: ");
14+
15+
Console.WriteLine((coin == 0) ? "Heads" : "Tails");
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)