Write a program that uses dynamic allocation to create an array of 20 integer numbers, find the smallest of these elements and calculate the average of elements. Your program should display the array elements, as well as the smallest and average of these elements. Note: You should use malloc() function for dynamic allocation of arrays.