Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using System.Collections.Generic;
- namespace ConsoleApp3
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int[] array1 = { 1, 2, 3, 5 };
- int[] array2 = { 1, 2, 3, 4, 5 };
- List<int> sumArray = new List<int>();
- for (int i = 0; i < array1.Length; i++)
- {
- sumArray.Add(array1[i]);
- }
- for (int i = 0; i < array2.Length; i++)
- {
- bool isAdd = true;
- foreach (var element in sumArray)
- {
- if (element == array2[i])
- {
- isAdd = false;
- }
- }
- if (isAdd)
- {
- sumArray.Add(array2[i]);
- }
- }
- foreach (var elemnt in sumArray)
- {
- Console.Write(elemnt + " ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment