Given an unsorted array of numbers, write an algorithm that confirms, if an array consists of consecutive elements or not.
a) If the array is {34, 23, 52, 12, 3 }, program should print, the elements are not consecutive. b) If array is {83, 78, 80, 81, 79, 82}, program should print, the array has consecutive numbers from 78 to 83.