c# Common Elements - Tech fundamentals
Здрасти хора, може ли да ми покажете къде бъркам, това е условието:
Write a program, which prints common elements in two arrays.
You have to compare the elements of the second array to the elements of the first.
И задачката:
using System;
using System.Linq;
namespace ConsoleApp59
{
class Program
static void Main(string[] args)
{
string[] arr1 = Console.ReadLine().Split().ToArray();
string[] arr2 = Console.ReadLine().Split().ToArray();
bool obshti = arr1.Intersect(arr2).Count() > 0;
string[] commonElements = arr1.Intersect(arr2).ToArray();
Console.WriteLine(commonElements);
}
}
}