CS
cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System;
using System.Collections.Generic;
using System.Linq;
namespace Sololearn
{
class Program
{
static void Main(string[] args)
{
int[] a={8,22,45,19,100,5,2};
Console.WriteLine("a = {0}", string.Join(", ",a));
int[] b={6,90,34,43};
Console.WriteLine("b = {0}", string.Join(", ",b));
//make Length even
if(a.Length<b.Length)
Array.Resize(ref a, b.Length);
else
Array.Resize(ref b, a.Length);
//use Zip with condtional function
var c = a.Zip(b, (i,j)=>i>j?i:j);
Console.WriteLine("c = {0}", string.Join(", ",c));
}
}
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run