Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Arrays
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] a = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
- int[] b = new int[] { 10, 11, 12 };
- int[] c = new int[Math.Max(a.Length, b.Length)];
- for (int index = 0; index < c.Length; index++)
- {
- int aValue = (a.Length > index) ? a[index] : b[index];
- int bValue = (b.Length > index) ? b[index] : a[index];
- c[index] = Math.Max(aValue, bValue);
- }
- //Console.WriteLine(String.Join(", ", c));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement