Program to find duplicate elements in an array and print them