CSharp · Console
using System;
using System.Text;
public class Program
{
public static void Main()
{
int[] someNumbers = { 1, 2, 3, 4, 5, 6 };
int[] winningNumbers = { 1, 2, 13, 14, 15, 16 };
int matched = 0;
StringBuilder sb = new StringBuilder();
sb.Append("You Matched ");
foreach (var item1 in someNumbers)
{
foreach (var item2 in winningNumbers)
{
if (item1 == item2)
{
matched++;
sb.Append(item1 + ",");
}
}
}
if (matched >= 2 )
{
Console.WriteLine("You won");
Console.WriteLine(sb.ToString().TrimEnd(','));
}
else
{
Console.WriteLine("You lost");
}
}
}