Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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 CSharpFundamentals/Set1-Task2/Set1-Task2.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Set1-Task2", "Set1-Task2\Se
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Set1-Task3", "Set1-Task3\Set1-Task3.csproj", "{EA12D075-EEBF-49C2-BB1B-05A7807A6FF6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Set1-Task4", "Set1-Task4\Set1-Task4.csproj", "{EDB01B7B-6A5E-4891-9E8F-146715BEE0F9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Set1-Task4", "Set1-Task4\Set1-Task4.csproj", "{EDB01B7B-6A5E-4891-9E8F-146715BEE0F9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Set1-Task7", "Set1-Task6\Set1-Task7.csproj", "{8512ACB8-A2EC-47C4-9FF8-BA30B984043C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -27,6 +29,10 @@ Global
{EDB01B7B-6A5E-4891-9E8F-146715BEE0F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EDB01B7B-6A5E-4891-9E8F-146715BEE0F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EDB01B7B-6A5E-4891-9E8F-146715BEE0F9}.Release|Any CPU.Build.0 = Release|Any CPU
{8512ACB8-A2EC-47C4-9FF8-BA30B984043C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8512ACB8-A2EC-47C4-9FF8-BA30B984043C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8512ACB8-A2EC-47C4-9FF8-BA30B984043C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8512ACB8-A2EC-47C4-9FF8-BA30B984043C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
50 changes: 50 additions & 0 deletions CSharpFundamentals/Set1-Task2/Set1-Task6/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
int[] player1Coin = new int[5] { 7, 5, 1, 25, 30 };
Comment thread
navjot1983 marked this conversation as resolved.
Outdated
int[] player2Coin = new int[5] { 5, 5, 10, 1, 25 };
double player1TotalScore = 0;
double player2TotalScore = 0;

for (int i = 0; i < player1Coin.Length;)
for (int j = 0; j < player2Coin.Length;)
Comment thread
navjot1983 marked this conversation as resolved.
{
if (player1Coin[i] > player2Coin[j])
{
player1TotalScore += 1;
Console.WriteLine("\n player one coin is : = " + player1Coin[i]);
Console.WriteLine(" player two coin is : = " + player2Coin[i]);
Comment thread
navjot1983 marked this conversation as resolved.
Console.WriteLine(" player one is the winner.");
Console.WriteLine("===========================");
}
else if (player1Coin[i] < player2Coin[j])
{
player2TotalScore += 1;
Console.WriteLine("\n player one coin is : = " + player1Coin[i]);
Console.WriteLine(" player two coin is : = " + player2Coin[i]);
Console.WriteLine(" player two is the winner.");
Console.WriteLine("===========================");
}
else
{
player1TotalScore += 0.5;
player2TotalScore += 0.5;
Console.WriteLine("\n player one coin is : = " + player1Coin[i]);
Console.WriteLine(" player two coin is : = " + player2Coin[i]);
Console.WriteLine(" Both player are the winners.");
Console.WriteLine("===========================");
}
i++;
j++;
}

if (player1TotalScore > player2TotalScore)
{
Console.WriteLine("\t\n.*******The winner of this game is Player1 with Score of := ." + player1TotalScore + ".*******");
}
else if (player1TotalScore < player2TotalScore)
{
Console.WriteLine("\t\n*******The winner of this game is Player2 with Score of := ." + player2TotalScore + ".*******");
}
else
{
Console.WriteLine("\t\n.*******The game is tie *******");
}
Console.ReadLine();
11 changes: 11 additions & 0 deletions CSharpFundamentals/Set1-Task2/Set1-Task6/Set1-Task7.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<RootNamespace>Set1_Task6</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>