Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- internal class Program
- {
- static void Main(string[] args)
- {
- string[] numbers = { "1", "4", "6", "1", "2", "12", "9", "7" };
- string[] numbers2 = { "3", "3", "2", "5", "8", "1", "4", "2" };
- List<string> combinedNumbers = new List<string>();
- AddNumbersToList(combinedNumbers, numbers);
- AddNumbersToList(combinedNumbers, numbers2);
- foreach (string number in combinedNumbers)
- {
- Console.Write(number + " ");
- }
- Console.ReadKey();
- }
- static void AddNumbersToList(List<string> finalNumbers, string[] elementaryNumbers)
- {
- foreach (string number in elementaryNumbers)
- {
- if (finalNumbers.Contains(number) == false)
- {
- finalNumbers.Add(number);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement