using System.Collections.Generic;
using System.Threading.Tasks;
namespace SmallestDifference
static void Main(string[] args)
int[] first = new int[6];
int[] second = new int[5];
Initialize(first, second);
var result = SmallestDifference(first, second);
Console.Write($"{result[0]}, {result[1]}");
private static int[] SmallestDifference(int[] first, int[] second)
int[] result = new int[2];
var firstLength = first.Length;
var secondLength = second.Length;
var smallestDifference = Int32.MaxValue;
while (firstLength != firstCounter && secondLength != secondCounter)
var left = first[firstCounter];
var right = second[secondCounter];
var currentDifference = Math.Abs(left - right);
if (currentDifference < smallestDifference)
smallestDifference = currentDifference;
static void Initialize(int[] first, int[] second)