Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace Hwork37
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- string[] arrayNumbersFirst = { "1", "2", "1", "4"};
- string[] arrayNumbersSecond = { "3", "2", "9", "3"};
- List<string> combineNumbers = new List<string>();
- AddNumbersInList(combineNumbers, arrayNumbersFirst);
- AddNumbersInList(combineNumbers, arrayNumbersSecond);
- ShowList(combineNumbers);
- }
- static void AddNumbersInList(List<string> listNumbers ,string[] arrayNumbers)
- {
- foreach (string number in arrayNumbers)
- {
- if (listNumbers.Contains(number) == false)
- {
- listNumbers.Add(number);
- }
- }
- }
- static void ShowList(List<string> listNumbers)
- {
- foreach (string number in listNumbers)
- {
- Console.WriteLine(number);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement