I'm stuck with arrays and need some help.
I have two arrays and I'm comparing it using foreach loop. I want the program to write "you won" ONLY if there are two numbers in winningNumbers that matches with someNumbers. If there is only one match, the output should be "You lost"
(I have to use loops to solve this problem)
int[] someNumbers = { 1, 2, 3, 4, 5, 6 };
int[] winningNumbers = { 1, 2, 13, 14, 15, 16 };
bool winning = false;
foreach (var item1 in someNumbers)
{
foreach (var item2 in winningNumbers)
{
if (item1 == item2)
{
winning = true;
}
}
}
if (winning == true )
{
Console.WriteLine("You won");
}
else
{
Console.WriteLine("You lost");
}