Advertisement
elena1234

Intersection Of two arrays

Dec 4th, 2021
1,067
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.46 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace IntersectionOfArrays
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int[] numbers = new int[] { 1, 2, 3 };
  11.             int[] secondNumbers = new int[] { 1, 4, 5 };
  12.             var element = numbers.Intersect(secondNumbers);
  13.             foreach (var item in element)
  14.             {
  15.                 Console.WriteLine(item);
  16.             }          
  17.         }
  18.     }
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement