Sort the array.
Now do a pass through the array similar to the inner loop of selection sort as follows:
min = 0;
for(int i = 1; i< n-1; i++)
{
if(diff(A[i], A[i+1]) < diff(A[min], A[min+1]) )
min = i;
}
Finally A[min], A[min+1] give our required numbers.