Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace GitHub
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] firstArr = new string[] { "Hey", "Hello", "2", "4" };
- string[] secondArr = new string[] { "10", "Hello", "2", "8" };
- string[] result = new string[secondArr.Length];
- int length = Math.Min(firstArr.Length, secondArr.Length);
- for (int i = 0; i < length; i++)
- {
- if (firstArr.Contains(secondArr[i]))
- {
- result[i] = secondArr[i];
- }
- }
- Console.WriteLine(string.Join(" ", result));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement