Given an unsorted array, the task is to find the least difference between the element pairs and display all the pairs present.
To solve this problem, we can follow the following steps:
1. Sort the given array.
2. Find the least difference among adjacent elements.
3. Print all the pairs with the least difference.
By applying the given solution, the pairs with the least difference {1, 2}, {2, 3}, {3, 4}, and {4, 5} can be obtained from the input array {5, 4, 3, 2, 1}.
A C programming solution for this problem is also provided in the news content.