Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CSharplearning.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Set1Task2", "Set1Task2\Set1
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Set1Task3", "Set1Task3\Set1Task3.csproj", "{A585E0AB-2EDD-451D-888D-C7520C6F7274}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Set1Task5", "Set1Task5\Set1Task5.csproj", "{7D5CF5FF-A5C2-4188-9BC4-4BF50CBED4C0}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Set1Task5", "Set1Task5\Set1Task5.csproj", "{7D5CF5FF-A5C2-4188-9BC4-4BF50CBED4C0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Set1Task6", "Set1Task6\Set1Task6.csproj", "{B6C410B4-B008-4F2B-9BB0-2FBC8CBB8B37}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -27,6 +29,10 @@ Global
{7D5CF5FF-A5C2-4188-9BC4-4BF50CBED4C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7D5CF5FF-A5C2-4188-9BC4-4BF50CBED4C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7D5CF5FF-A5C2-4188-9BC4-4BF50CBED4C0}.Release|Any CPU.Build.0 = Release|Any CPU
{B6C410B4-B008-4F2B-9BB0-2FBC8CBB8B37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B6C410B4-B008-4F2B-9BB0-2FBC8CBB8B37}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B6C410B4-B008-4F2B-9BB0-2FBC8CBB8B37}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B6C410B4-B008-4F2B-9BB0-2FBC8CBB8B37}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
64 changes: 64 additions & 0 deletions Set1Task6/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using System;

namespace Set1Task6
{
internal class Program
{
static void Main(string[] args)
{
Random dice = new Random();
int player1 = dice.Next(1,7);
int player2 = dice.Next(1,7);
int player3 = dice.Next(1, 7);
int player4 = dice.Next(1, 7);
int player5 = dice.Next(1, 7);

Console.WriteLine("Player 1: " + player1);
Console.WriteLine("Player 2: " + player2);
Console.WriteLine("Player 3: " + player3);
Console.WriteLine("Player 4: " + player4);
Console.WriteLine("Player 5: " + player5);

if ((player1 == player2)|| (player1 == player3)|| (player1 == player4)|| (player1 == player5))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

player1 == player2 is same as player2 == player1.
In this case both player1 and player2 are moved to next level

{
Console.WriteLine("Player1 won the game and moved to next level");
}
else
{
Console.WriteLine("Player1 didnt move to the next level");
}
if ((player2 == player1) || (player2 == player3) || (player2 == player4) || (player2 == player5))
{
Console.WriteLine("Player2 won the game and moved to next level");
}
else
{
Console.WriteLine("Player2 didnt move to the next level");
}
if ((player3 == player1) || (player3 == player2) || (player3 == player4) || (player3 == player5))
{
Console.WriteLine("Player3 won the game and moved to next level");
}
else
{
Console.WriteLine("Player3 didnt move to the next level");
}
if ((player4 == player1) || (player4 == player2) || (player4 == player3) || (player4 == player5))
{
Console.WriteLine("Player4 won the game and moved to next level");
}
else
{
Console.WriteLine("Player4 didnt move to the next level");
}
if ((player5 == player1) || (player5 == player2) || (player5 == player3) || (player5 == player4))
{
Console.WriteLine("Player5 won the game and moved to next level");
}
else
{
Console.WriteLine("Player5 didnt move to the next level");
}
}
}
}
8 changes: 8 additions & 0 deletions Set1Task6/Set1Task6.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

</Project>